Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- connect() ->
- case gen_tcp:connect("localhost", ?PORTS_GATEWAY_TO_CHATNODE, [binary, {active, false}]) of
- exit ->
- ok;
- {ok, Socket} ->
- io:format("[NODE] Connected~n"),
- self() ! online,
- recv(Socket);
- {error, Reason} ->
- io:format("[NODE] [ERR] Connect failed: ~p~n", [Reason]),
- receive
- exit ->
- io:format("[CONNECT] Exiting~n")
- after 5000 ->
- connect()
- end
- end.
Add Comment
Please, Sign In to add comment