it begindth
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
-module(hello_client).
|
||||
|
||||
-export([main/0]).
|
||||
|
||||
main() ->
|
||||
{ok, Socket} = gen_tcp:connect("localhost", 6969, [binary, {packet, 0}]),
|
||||
loop(Socket).
|
||||
|
||||
loop(Socket) ->
|
||||
ok = inet:setopts(Socket, [{active, once}]),
|
||||
receive
|
||||
{tcp, Socket, Bytes} ->
|
||||
ok = io:format("< ~tp~n", [Bytes]),
|
||||
loop(Socket);
|
||||
{tcp_closed, Socket} ->
|
||||
ok = io:format("connection terminated~n", []),
|
||||
exit(normal)
|
||||
end.
|
||||
Reference in New Issue
Block a user