[erlang-questions] eaddrinuse despite {reuseaddr, true}
aman mangal
mangalaman93@REDACTED
Thu Sep 5 09:58:52 CEST 2013
Hi,
The error is thrown in the first line. It is returning *{error, **
eaddrinuse}* (where you are expeciting *{ok, LSock}*) because the port is
already being used by some different process. Two process cannot listen on
the same port at a time.
Aman Mangal
4th year Undergraduate Student
Department of Computer Science & Engineering
IIT Bombay
www.cse.iitb.ac.in/~amanmangal
On Thu, Sep 5, 2013 at 1:16 PM, JD Bothma <jbothma@REDACTED> wrote:
> Why can this sometimes exit with exception error: no match of right hand
> side value {error,eaddrinuse} ?
>
> As far as I know, nothing's connecting to the socket in this time.
>
> [ begin {ok, LSock} = gen_tcp:listen(12345, [{reuseaddr, true}]),
> {error, timeout} = gen_tcp:accept(LSock, 0),
> ok = gen_tcp:close(LSock)
> end
> || _X <- lists:seq(1, 100000) ].
>
> This is on R14 and 15 on linux and R16 on OS X.
>
> BTW it doesn't seem to happen if I don't accept. I'm debugging this
> behaviour in yaws with SSL but it also seems to happen with plain gen_tcp.
>
> JD
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130905/5c766b59/attachment.htm>
More information about the erlang-questions
mailing list