[erlang-questions] eaddrinuse despite {reuseaddr, true}

JD Bothma jbothma@REDACTED
Thu Sep 5 09:46:11 CEST 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130905/183dd6c9/attachment.htm>


More information about the erlang-questions mailing list