On 08/10/2019 15:29, Alan Bateman wrote:
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.

+1 : you would be in uncharted territory and that's exactly why
we want to throw an exception when rebind fails and why we recommend
closing the channel when that happens.

-- daniel


-Alan.

Reply via email to