the socket can't bind?

Bruce M. Simpson bms at FreeBSD.org
Fri Jan 11 11:15:07 PST 2008


SnaiX wrote:
> So it would run 1-4. but it reports EADDRINUSE after bind.
>
> Why?

The stack assumes that SO_REUSEADDR is never cleared on a socket after 
it gets set.

>  How to resolve it? Should I dup() the fd?
>   
Did you close the affected socket in (5) ?

Presumably you are still trying to use the same port; is it a 
non-ephemeral port? You might want to consider SO_REUSEPORT although I 
believe FreeBSD doesn't fully support it for non-multicast.

BMS


More information about the freebsd-net mailing list