From 2ca6a45ba9d38209c342bbd1064e9d2b400e34f0 Mon Sep 17 00:00:00 2001 From: Mateusz Krawczuk Date: Sat, 20 Jun 2020 01:52:55 +0200 Subject: [PATCH] doc: mention errors thrown by methods called on an unbound dgram.Socket PR-URL: https://github.com/nodejs/node/pull/33983 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott Reviewed-By: Trivikram Kamat Reviewed-By: James M Snell --- doc/api/dgram.md | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/doc/api/dgram.md b/doc/api/dgram.md index db93e1f2089916..8e8f06551b7dac 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, this method will implicitly bind 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,9 @@ 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, this method will implicitly bind 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])`