From 530adfdb2a3357e3b8aa43fbd488bbdff04b5fc0 Mon Sep 17 00:00:00 2001 From: Matt Crummey Date: Thu, 1 Dec 2016 17:59:47 +0000 Subject: [PATCH] doc: improve rinfo object documentation Provide details for fields of rinfo object of UDP message event. PR-URL: https://github.com/nodejs/node/pull/10050 Reviewed-By: James M Snell --- doc/api/dgram.md | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/doc/api/dgram.md b/doc/api/dgram.md index 92e51b7072aeee..b80289f6c99bdd 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -70,20 +70,14 @@ datagram messages. This occurs as soon as UDP sockets are created. added: v0.1.99 --> +The `'message'` event is emitted when a new datagram is available on a socket. +The event handler function is passed two arguments: `msg` and `rinfo`. * `msg` {Buffer} - The message * `rinfo` {Object} - Remote address information - -The `'message'` event is emitted when a new datagram is available on a socket. -The event handler function is passed two arguments: `msg` and `rinfo`. The -`msg` argument is a [`Buffer`][] and `rinfo` is an object with the sender's -address information provided by the `address`, `family` and `port` properties: - -```js -socket.on('message', (msg, rinfo) => { - console.log('Received %d bytes from %s:%d\n', - msg.length, rinfo.address, rinfo.port); -}); -``` + * `address` {String} The sender address + * `family` {String} The address family (`'IPv4'` or `'IPv6'`) + * `port` {Number} The sender port + * `size` {Number} The message size ### socket.addMembership(multicastAddress[, multicastInterface])