Skip to content
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
doc: Update rinfo object definition for UDP message event
Detailing fields of object
  • Loading branch information
Matt Crummey
Matt Crummey committed Dec 24, 2016
commit c757255ae58fad2f29a84c1b5c89c407e3668158
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