Close the socket and drop the reference. Idempotent.
Create and bind the socket, wiring the message/error listeners. Idempotent.
onMessage is a convenience for callers that register the handler at open time rather
than up front; passing it is the same as calling setMessageHandler first.
An error raised BEFORE the bind completes (EADDRINUSE, a permission denial) rejects
the open — a caller must not be left awaiting a socket that will never bind. Errors
after the bind are transport-level noise (the ICMP port-unreachable a silent desk
generates) and go to the setErrorHandler sink, which is optional precisely so an
adapter can ignore them.
OptionalonMessage: (msg: Buffer) => voidSend one packet to the desk. Resolves once the OS accepts the datagram (fire-and-forget: a UDP control plane does not ACK).
Register a transport-level error handler.
Register the inbound-datagram handler (replies + subscription pushes).
Fire-and-forget UDP sender plus an inbound message pump. Owns one bound socket for the connection's lifetime; all datagrams go to
host:port.