[erlang-questions] Socket connects to itself

Per Hedeland per@REDACTED
Tue Oct 13 12:37:07 CEST 2009


Tony Rogvall <tony@REDACTED> wrote:
>
>In C you could of course check the bound port before connecting.

Actually no, you couldn't, since the bind happens implicitly as part of
the connect() call. What you *could* do in C but not in Erlang would be
to explicitly bind the socket before the connect, but of course that
carries a whole can of worms that you really don't want to open for this
case.

>And I guess the same fix could be applied to prim_inet if that is what  
>you want ;-)

Personally I don't care much:-), but I don't see any particular reason
that Erlang should work differently from C in this (unusual) case. Maybe
the TCP/IP stack "should" reject this particular case of "simultaneous
initiation" since it is meaningless though - maybe some of them actually
do.

--Per


More information about the erlang-questions mailing list