From 9b471c59a5c1210d67796ac9f94da90d15d8059f Mon Sep 17 00:00:00 2001 From: Harshitha KP Date: Tue, 31 Mar 2020 07:10:26 -0400 Subject: [PATCH 1/2] doc: clarify `listening` event Co-authored-by: Divyanshu --- doc/api/dgram.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/api/dgram.md b/doc/api/dgram.md index d3eee26cdd5ac0..4c8893b7aa2dbe 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -73,8 +73,11 @@ function is passed a single `Error` object. added: v0.1.99 --> -The `'listening'` event is emitted whenever a socket begins listening for -datagram messages. This occurs as soon as UDP sockets are created. +The `'listening'` event is emitted once the `dgram.Socket` is addressable and +can receive data.This happens either explicitly with `socket.bind()` or +implicitly the first time data is sent using `socket.send()`. +Until the `dgram.Socket` is listening, the underlying system resources do not +exist and calls such as `socket.address()` and `socket.SetTTL()` will fail. ### Event: `'message'` The `'listening'` event is emitted once the `dgram.Socket` is addressable and -can receive data.This happens either explicitly with `socket.bind()` or +can receive data. This happens either explicitly with `socket.bind()` or implicitly the first time data is sent using `socket.send()`. Until the `dgram.Socket` is listening, the underlying system resources do not -exist and calls such as `socket.address()` and `socket.SetTTL()` will fail. +exist and calls such as `socket.address()` and `socket.setTTL()` will fail. ### Event: `'message'`