United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6432031 : No way to access SO_REUSEPORT on sockets

Details
Type:
Enhancement
Submit Date:
2006-05-31
Status:
Closed
Updated Date:
2013-03-27
Project Name:
JDK
Resolved Date:
2013-03-27
Component:
core-libs
OS:
solaris_10
Sub-Component:
java.net
CPU:
sparc
Priority:
P5
Resolution:
Won't Fix
Affected Versions:
5.0
Fixed Versions:

Related Reports

Sub Tasks

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
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.
                                     
2013-03-27
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.
                                     
2006-05-31



Hardware and Software, Engineered to Work Together