SO_REUSEADDR should not also mean SO_REUSEPORT

Kurt Miller lists at intricatesoftware.com
Fri Feb 17 07:54:20 PST 2006


On Thursday 16 February 2006 4:44 pm, Arne Juul wrote:
> Description by Håvard Pettersen 
> (Havard.Pettersen at europe.yahoo-inc.com) 	> Ticket Opened: 2006-02-02 
> 13:37 PST
>  >
>  > In the FreeBSD Java port, setting the reuse_address feature on a
>  > server socket also sets the reuse_port feature, which is not a good
>  > thing, since it allows multiple server sockets to bind to the same
>  > local port.
>  >
>  > A possible work-around is to also disable reuse_address, but this
>  > will disallow listening to an unused local port if a connection
>  > established against that port is still active, which is not good
>  > either.
> 
> 
> I don't know why this code was put into the bsd jdk patches, it just
> seems plain wrong to me.  It makes java subtly non-portable in a very
> strange manner; I suggest this code is removed.  Below is the patch
> I'm currently using :-)

Linux and Solaris don't have SO_REUSEPORT. I believe their
SO_REUSEADDR is equivalent to SO_REUSEADDR + SO_REUSEPORT
on bsd.

-Kurt


More information about the freebsd-java mailing list