RFR: 8319417: (dc) DatagramChannel.connect undocumented behavior [v2]

Alan Bateman alanb at openjdk.org
Tue Nov 28 19:02:08 UTC 2023


On Tue, 28 Nov 2023 18:49:53 GMT, Mark Sheppard <msheppar at openjdk.org> wrote:

> Returns: the local address to which the socket is bound, null if the socket is closed, or an InetAddress representing [wildcard](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/net/InetAddress.html#isAnyLocalAddress()) address if either the socket is not bound, or the security manager checkConnect method does not allow the operation

DatagramSocket.getLocalAddress dates from JDK 1.1 and its odd behavior couldn't be changed for compatibility reasons. The newer DatagramSocket.getLocalSocketAddress is specified to return null when not bound.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/16635#issuecomment-1830492998


More information about the nio-dev mailing list