Skip to content

Commit e86bf27

Browse files
Matt Crummeyevanlucas
Matt Crummey
authored andcommitted
doc: improve rinfo object documentation
Provide details for fields of rinfo object of UDP message event. PR-URL: #10050 Reviewed-By: James M Snell <[email protected]>
1 parent 5164b56 commit e86bf27

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

doc/api/dgram.md

+6-12
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,14 @@ datagram messages. This occurs as soon as UDP sockets are created.
7070
added: v0.1.99
7171
-->
7272

73+
The `'message'` event is emitted when a new datagram is available on a socket.
74+
The event handler function is passed two arguments: `msg` and `rinfo`.
7375
* `msg` {Buffer} - The message
7476
* `rinfo` {Object} - Remote address information
75-
76-
The `'message'` event is emitted when a new datagram is available on a socket.
77-
The event handler function is passed two arguments: `msg` and `rinfo`. The
78-
`msg` argument is a [`Buffer`][] and `rinfo` is an object with the sender's
79-
address information provided by the `address`, `family` and `port` properties:
80-
81-
```js
82-
socket.on('message', (msg, rinfo) => {
83-
console.log('Received %d bytes from %s:%d\n',
84-
msg.length, rinfo.address, rinfo.port);
85-
});
86-
```
77+
* `address` {String} The sender address
78+
* `family` {String} The address family (`'IPv4'` or `'IPv6'`)
79+
* `port` {Number} The sender port
80+
* `size` {Number} The message size
8781

8882
### socket.addMembership(multicastAddress[, multicastInterface])
8983
<!-- YAML

0 commit comments

Comments
 (0)