In Erlang, how do I get the client ip and port?
In the following code, the server listens on port 2345. After accepting a connection from the client, it returns {ok, Socket}
start() ->
{ok, Listen} = gen_tcp:listen(2345, [binary, {packet, 4},
{reuseaddr, true},
{active, true}]),
{ok, Socket} = gen_tcp:accept(Listen).
I want to get the client IP and port, how can I get them by parsing the socket?
+3
source to share