-
Bug
-
Resolution: Fixed
-
P4
-
6
-
b18
-
generic
-
generic
-
Verified
The specification for SocketOptions.SO_BINDADDR has some legacy wording:
"Fetch the local address binding of a socket (this option cannot be "set" only "gotten", since sockets are bound at creation time, and so the locally bound address cannot be changed)."
The statement "socket are bound at creation time" appears to be out-dated. Since 1.4 it has been possible to create unbound sockets so this means the socket will not be bound until the socket is connected or explicitly bound.
The statement "the locally bound address cannot be changed" should probably be expanded upon to. While the address can't be changed explicily, it can be changed implicitly - eg: bind a DatagramSocket to the wildcard address and then connect it to a remote address. In that case the local address will change to a specific address while the socket is connected. If the socket is disconnected then the local address be again be reported as the wildcard address.
"Fetch the local address binding of a socket (this option cannot be "set" only "gotten", since sockets are bound at creation time, and so the locally bound address cannot be changed)."
The statement "socket are bound at creation time" appears to be out-dated. Since 1.4 it has been possible to create unbound sockets so this means the socket will not be bound until the socket is connected or explicitly bound.
The statement "the locally bound address cannot be changed" should probably be expanded upon to. While the address can't be changed explicily, it can be changed implicitly - eg: bind a DatagramSocket to the wildcard address and then connect it to a remote address. In that case the local address will change to a specific address while the socket is connected. If the socket is disconnected then the local address be again be reported as the wildcard address.