| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -70,20 +70,14 @@ datagram messages. This occurs as soon as UDP sockets are created. | |||
| 70 | 70 | added: v0.1.99 | |
| 71 | 71 | --> | |
| 72 | 72 | ||
| 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`. | ||
| 73 | 75 | * `msg` {Buffer} - The message | |
| 74 | 76 | * `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 | ||
| 87 | 81 | ||
| 88 | 82 | ### socket.addMembership(multicastAddress[, multicastInterface]) | |
| 89 | 83 | <!-- YAML | |
| Back | FazBrowse Home | New Git URL |
0 commit comments