From 935eb1b6b8b42318262447e3f54de024c18cce0a Mon Sep 17 00:00:00 2001 From: Mateusz Krawczuk Date: Sat, 20 Jun 2020 01:52:55 +0200 Subject: [PATCH 1/3] doc: mention errors thrown by methods called on an unbound dgram.Socket --- doc/api/dgram.md | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/doc/api/dgram.md b/doc/api/dgram.md index 05cab4e9b604b7..2912a7c3dce01d 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -108,6 +108,9 @@ Tells the kernel to join a multicast group at the given `multicastAddress` and one interface and will add membership to it. To add membership to every available interface, call `addMembership` multiple times, once per interface. +When called on an unbound socket, implicitly binds to a random port, listening +on all interfaces. + When sharing a UDP socket across multiple `cluster` workers, the `socket.addMembership()` function must be called only once or an `EADDRINUSE` error will occur: @@ -143,6 +146,10 @@ is not specified, the operating system will choose one interface and will add membership to it. To add membership to every available interface, call `socket.addSourceSpecificMembership()` multiple times, once per interface. + +When called on an unbound socket, implicitly binds to a random port, listening +on all interfaces. + ### `socket.address()` A synchronous function that disassociates a connected `dgram.Socket` from -its remote address. Trying to call `disconnect()` on an already disconnected -socket will result in an [`ERR_SOCKET_DGRAM_NOT_CONNECTED`][] exception. +its remote address. Trying to call `disconnect()` on an unbound or already +disconnected socket will result in an [`ERR_SOCKET_DGRAM_NOT_CONNECTED`][] +exception. ### `socket.dropMembership(multicastAddress[, multicastInterface])`