<div dir="ltr">Hi,<br><div class="gmail_extra"><div><div dir="ltr"><br></div><div dir="ltr">The error is thrown in the first line. It is returning <i>{error, </i><span style="font-family:arial,sans-serif;font-size:13px"><i>eaddrinuse}</i> (where you are expeciting <i>{ok, LSock}</i>) because the port is already being used by some different process. Two process cannot listen on the same port at a time.</span></div>
<div dir="ltr"><br><font style="color:rgb(102,51,51);font-family:tahoma,sans-serif">Aman Mangal</font><div><font style="color:rgb(102,51,51);font-family:tahoma,sans-serif">4th year Undergraduate Student<br>Department of Computer Science & Engineering<br>
IIT Bombay<br></font><a href="http://www.cse.iitb.ac.in/~amanmangal" target="_blank">www.cse.iitb.ac.in/~amanmangal</a>
</div></div></div>
<br><br><div class="gmail_quote">On Thu, Sep 5, 2013 at 1:16 PM, JD Bothma <span dir="ltr"><<a href="mailto:jbothma@gmail.com" target="_blank">jbothma@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div>Why can this sometimes exit with exception error: no match of right hand side value {error,eaddrinuse} ?</div><div><br></div><div>As far as I know, nothing's connecting to the socket in this time.</div>
<div><br></div>[ begin {ok, LSock} = gen_tcp:listen(12345, [{reuseaddr, true}]),<div> {error, timeout} = gen_tcp:accept(LSock, 0),</div><div> ok = gen_tcp:close(LSock)</div><div> end </div><div> || _X <- lists:seq(1, 100000) ].<br>
</div><div><br></div><div>This is on R14 and 15 on linux and R16 on OS X.</div><div><br></div><div>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.</div>
<span><font color="#888888">
<div><br></div><div>JD</div></font></span></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div></div>