DatagramChannel::disconnect appears to rebind socket to the wildcard address

Alan Bateman Alan.Bateman at oracle.com
Wed Sep 25 17:38:55 UTC 2019


Is this project this active? Are there folks here that work on the 
xxxBSD ports?

JDK-8231259 [1] is a bug submitted against the 
java.nio.channels.DatagramChannel implementation on macOS a few days 
ago. It looks like a macOS bug, rather than a JDK bug.

The scenario is a UDP socket is bound to a specific local address, 
connected, and then disconnected (to dissolve the association). It seems 
that the disconnect changes the local address (as reported by 
getsocketname) to the wildcard address (INADDR_ANY or the IPv6 
equivalent). There are several ways to disconnect (disconnectx, connect 
with an invalid address, or connect with a family of AF_UNSPEC) and the 
unexplained behavior arises with all.

If there are still people here then I'm wondering if the same behavior 
is observed on other BSD operating systems. That is, does UDP disconnect 
deliberately change the local address to INADDR_ANY?

Thanks,

-Alan

[1] https://bugs.openjdk.java.net/browse/JDK-8231259


More information about the bsd-port-dev mailing list