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

Michael McMahon michaelm at openjdk.org
Tue Nov 28 16:46:07 UTC 2023


On Tue, 28 Nov 2023 13:35:33 GMT, Mark Sheppard <msheppar at openjdk.org> wrote:

> The current wording says that: "If the channel's socket was initially bound to the wildcard address and is now {@link #isConnected connected}, then the address returned may be the local address selected as the source address for datagrams sent via this channel instead of the wildcard address."
> 
> The may is a bit ambiguous ... is this OS dependent or is it universal that for a connected DatagramSocket or DatagramChannel then the local address of the intreface for which the send was routed will be returned. If it is OS dependent, should that be stated, also ?
> 
> Also, the return for the case of an unbound DatagramSocket or DatagramChannel is not specified.

That is the behavior for the main supported platforms. We had a concern that it might not be the case on other platforms. Hence, the word "may".

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

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


More information about the nio-dev mailing list