1 -module(network_supervisor
).
4 start( address
, port
, game_pid
, server_pid
) ->
5 {ok
, Lsocket
} = gen_tcp:listen(port
, [binary]),
9 case gen_tcp:accept(LSocket
) of
11 loop(socket
, game_pid
, server_pid
),
14 io:format("accept returned"),
18 loop( socket
, game_pid
, server_pid
)->
19 inet:setopts(socket
,[{active
,once
}]),
23 gen_tcp:send("answer" , socket
),
24 loop( socket
, game_pid
, server_pid
);
25 {tcp_closed
,socket
} ->
26 io:format("Socket ~w closed [~w]~n",[socket
,self()]),