[erlang-questions] Peername of a closed TCP socket

Malcolm Dowse <>
Tue May 26 17:39:46 CEST 2009


Hello,

When a TCP client disconnects very soon after connecting to an Erlang
server, is there any reliable way of getting the client's remote address?

The inet:peername/1 function returns an error if the socket in question has
closed. As a result, I can't find any better solution than to refactor the
code so that inet:peername/1 is called as soon as possible after the
gen_tcp:accept/1.

Thanks in advance,

malcolm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090526/1a0bee12/attachment.html>


More information about the erlang-questions mailing list