Whether the socket is bound.
The port actually bound — the configured one, unless it was 0, in which case the OS chose.
0 before the bind completes. Binding 0 is how a test gets a real socket without racing
another test for a fixed number, and it is the only reason a caller cannot simply read back
what it configured.
Close the socket and drop the reference. Idempotent.
Bind the socket. Idempotent: a second call on an open endpoint does nothing.
OptionalonDatagram: UdpDatagramHandlerSend one datagram to one peer. Resolves once the OS accepts it — fire and forget, because a UDP control plane does not ACK and a caller that awaited delivery would be waiting on something that never arrives.
Register the inbound-datagram handler. Replaces any previous one.
Register a transport-level error handler.
Post-bind UDP errors are noise a control plane survives — the ICMP port-unreachable a peer that went away generates arrives here, once per datagram sent to it. A caller that logs every one of them will drown; a caller that ignores them is fine.
A bound UDP socket that reports the sender, and sends to any peer.
open()rejects if the bind fails —EADDRINUSEon a port somebody else holds is a startup failure a caller must see, not a warning it can run past into a surface that will never receive anything.