RFR: 8231260: (dc) DatagramChannel::disconnect changes the port of the local address to 0 (lnx)

Alan Bateman Alan.Bateman at oracle.com
Tue Oct 8 14:29:19 UTC 2019


On 08/10/2019 15:20, mark sheppard wrote:
> :
>
> Q: is  localAddress.getPort() == 0   indicative that the DatagramChannel is unbound ?
>
getLocalAddress() returns a SocketAddress when bound, it returns null 
when not bound. I don't think we should get too hung up on corner case 
that arises when the local port cannot be restored (by re-binding). The 
javadoc sets the expectations that the channel's socket is in an 
undefined state when disconnect fails.

-Alan.


More information about the nio-dev mailing list