Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: Update rinfo object definition for UDP message event #10050

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions doc/api/dgram.md
Original file line number Diff line number Diff line change
Expand Up @@ -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's address
* `family` {String} The address's family `'IPv4'` or `'IPv6'`
* `port` {Number} The sender's port
* `size` {Number} The message size

### socket.addMembership(multicastAddress[, multicastInterface])
<!-- YAML
Expand Down