-module(test3).

-export([start/0, server/0]).

start() ->
  Pid = spawn_link(?MODULE, server, []),
  case catch client(Pid, [10, 20, 30, 50, 60, 80, 90, 180]) of
    ok ->
      io:fwrite("all OK~n");
    Else ->
      io:fwrite("not OK: ~p~n", [Else])
  end.

client(Pid, []) ->
  ok;
client(Pid, [Head | Tail]) ->
  Pid ! Head + 1,
  client(Pid, Tail).

server() ->
  loop().

loop() ->
  receive
    Msg ->
      io:fwrite("got ~p~n", [integer_to_list(Msg)]),
      loop()
  end.
