[erlang-questions] how can I get the ip address from a socket

Christian S chsu79@REDACTED
Thu Nov 23 09:51:56 CET 2006


inet:peername/1

On 11/23/06, Arbow <avindev@REDACTED> wrote:
> Deal all:
>
>        I wrote a simple echo_server, want to print incoming
> connections ip address.
>
>     case gen_tcp:accept(ListenSocket) of
>         {ok, ClientSocket} -> .............
>
> I got the ClientSocket,  and output it :
>
> io:format("Socket ~p connected~n", [ClientSocket]),
>
> The simple output is:
> Socket #Port<0.96> connected
>
> Now I want to get the ip address and port of these remote peers, how I
> can do ? I can't find any releative functions from module gen_tcp.
>
> Thanks.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list