JDK-6432031 : Add support for SO_REUSEPORT
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 5.0
  • Priority: P5
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_10
  • CPU: sparc
  • Submitted: 2006-05-31
  • Updated: 2017-05-16
  • Resolved: 2016-02-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b108Fixed
Related Reports
CSR :  
Description
A DESCRIPTION OF THE REQUEST :
There is no way to access the SO_REUSEPORT socket option in the JDK.  The addition of a setReusePort() and getReusePort() function equivalent to setReuseAddress() and getReuseAddress() would fill this gap.

Alternatively, a more generic way of setting and querying individual socket options would suffice.

JUSTIFICATION :
Quite a lot of peer to peer systems are now making use of this flag in order to avoid having to configure many ports on network address translators.  With this flag, both outgoing and incoming connections can be bound to the same port and consequently remain bound to the same external port of the NAT.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Add setReusePort() and getReusePort() to the JDK.
ACTUAL -
Not applicable.

---------- BEGIN SOURCE ----------
Not applicable.
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Not applicable.

Comments
Code contributed by Yingqi (Lucy) Lu http://cr.openjdk.java.net/~mcberg/jdk/6432031/webrev.02/ Most recent version is: http://cr.openjdk.java.net/~mcberg/jdk/6432031/webrev.11/
11-02-2016

Should the option be added to jdk.net.ExtendedSocketOption instead?
16-11-2015

SO_REUSEPORT is now on MacOS (possibly introduced in 10.9). Not sure about the status of Windows. I'm reopening this RFE. I think we should reconsider the possibility of adding this since it's become more widespread.
30-03-2015

SO_REUSEPORT is now in Solaris. It might have been added in Solaris 11.
17-12-2014

SO_REUSEPORT is not supported on Windows and Solaris. We do not have plans of supporting this option unless it is available on all platforms.
27-03-2013

EVALUATION SO_REUSEPORT is introduced in BSD4.4, mainly for multicast. The sematic is to allow completely duplicate bindings, but only if each socket that wants to bind the same IP address and port specify this socket option. The problem is not all systems support this option. Currently, Solaris and Windows seem not support it yet. But when binding to multicast IP address, SO_REUSEADDR is considered equivalent to SO_REUSEPORT. May check the situation in future release.
31-05-2006