Skip to content

Commit 379d916

Browse files
lpincajasnell
authored andcommitted
doc: add added: information for dgram
PR-URL: #8196 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 2367e6c commit 379d916

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

doc/api/dgram.md

+51
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ server.bind(41234);
2929
```
3030

3131
## Class: dgram.Socket
32+
<!-- YAML
33+
added: v0.1.99
34+
-->
3235

3336
The `dgram.Socket` object is an [`EventEmitter`][] that encapsulates the
3437
datagram functionality.
@@ -37,23 +40,35 @@ New instances of `dgram.Socket` are created using [`dgram.createSocket()`][].
3740
The `new` keyword is not to be used to create `dgram.Socket` instances.
3841

3942
### Event: 'close'
43+
<!-- YAML
44+
added: v0.1.99
45+
-->
4046

4147
The `'close'` event is emitted after a socket is closed with [`close()`][].
4248
Once triggered, no new `'message'` events will be emitted on this socket.
4349

4450
### Event: 'error'
51+
<!-- YAML
52+
added: v0.1.99
53+
-->
4554

4655
* `exception` {Error}
4756

4857
The `'error'` event is emitted whenever any error occurs. The event handler
4958
function is passed a single Error object.
5059

5160
### Event: 'listening'
61+
<!-- YAML
62+
added: v0.1.99
63+
-->
5264

5365
The `'listening'` event is emitted whenever a socket begins listening for
5466
datagram messages. This occurs as soon as UDP sockets are created.
5567

5668
### Event: 'message'
69+
<!-- YAML
70+
added: v0.1.99
71+
-->
5772

5873
* `msg` {Buffer} - The message
5974
* `rinfo` {Object} - Remote address information
@@ -85,12 +100,18 @@ one interface and will add membership to it. To add membership to every
85100
available interface, call `addMembership` multiple times, once per interface.
86101

87102
### socket.address()
103+
<!-- YAML
104+
added: v0.1.99
105+
-->
88106

89107
Returns an object containing the address information for a socket.
90108
For UDP sockets, this object will contain `address`, `family` and `port`
91109
properties.
92110

93111
### socket.bind([port][, address][, callback])
112+
<!-- YAML
113+
added: v0.1.99
114+
-->
94115

95116
* `port` {Number} - Integer, Optional
96117
* `address` {String}, Optional
@@ -139,6 +160,9 @@ server.bind(41234);
139160
```
140161

141162
### socket.bind(options[, callback])
163+
<!-- YAML
164+
added: v0.11.14
165+
-->
142166

143167
* `options` {Object} - Required. Supports the following properties:
144168
* `port` {Number} - Required.
@@ -172,6 +196,9 @@ socket.bind({
172196
```
173197

174198
### socket.close([callback])
199+
<!-- YAML
200+
added: v0.1.99
201+
-->
175202

176203
Close the underlying socket and stop listening for data on it. If a callback is
177204
provided, it is added as a listener for the [`'close'`][] event.
@@ -193,6 +220,9 @@ If `multicastInterface` is not specified, the operating system will attempt to
193220
drop membership on all valid interfaces.
194221

195222
### socket.send(msg, [offset, length,] port, address[, callback])
223+
<!-- YAML
224+
added: v0.1.99
225+
-->
196226

197227
* `msg` {Buffer|String|Array} Message to be sent
198228
* `offset` {Number} Integer. Optional. Offset in the buffer where the message starts.
@@ -300,13 +330,19 @@ Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP
300330
packets may be sent to a local interface's broadcast address.
301331

302332
### socket.setMulticastLoopback(flag)
333+
<!-- YAML
334+
added: v0.3.8
335+
-->
303336

304337
* `flag` {Boolean}
305338

306339
Sets or clears the `IP_MULTICAST_LOOP` socket option. When set to `true`,
307340
multicast packets will also be received on the local interface.
308341

309342
### socket.setMulticastTTL(ttl)
343+
<!-- YAML
344+
added: v0.3.8
345+
-->
310346

311347
* `ttl` {Number} Integer
312348

@@ -320,6 +356,9 @@ The argument passed to to `socket.setMulticastTTL()` is a number of hops
320356
between 0 and 255. The default on most systems is `1` but can vary.
321357

322358
### socket.setTTL(ttl)
359+
<!-- YAML
360+
added: v0.1.101
361+
-->
323362

324363
* `ttl` {Number} Integer
325364

@@ -333,6 +372,9 @@ The argument to `socket.setTTL()` is a number of hops between 1 and 255.
333372
The default on most systems is 64 but can vary.
334373

335374
### socket.ref()
375+
<!-- YAML
376+
added: v0.9.1
377+
-->
336378

337379
By default, binding a socket will cause it to block the Node.js process from
338380
exiting as long as the socket is open. The `socket.unref()` method can be used
@@ -346,6 +388,9 @@ The `socket.ref()` method returns a reference to the socket so calls can be
346388
chained.
347389

348390
### socket.unref()
391+
<!-- YAML
392+
added: v0.9.1
393+
-->
349394

350395
By default, binding a socket will cause it to block the Node.js process from
351396
exiting as long as the socket is open. The `socket.unref()` method can be used
@@ -383,6 +428,9 @@ s.bind(1234, () => {
383428
## `dgram` module functions
384429

385430
### dgram.createSocket(options[, callback])
431+
<!-- YAML
432+
added: v0.11.13
433+
-->
386434

387435
* `options` {Object}
388436
* `callback` {Function} Attached as a listener to `'message'` events.
@@ -405,6 +453,9 @@ and `udp6` sockets). The bound address and port can be retrieved using
405453
[`socket.address().address`][] and [`socket.address().port`][].
406454

407455
### dgram.createSocket(type[, callback])
456+
<!-- YAML
457+
added: v0.1.99
458+
-->
408459

409460
* `type` {String} - Either 'udp4' or 'udp6'
410461
* `callback` {Function} - Attached as a listener to `'message'` events.

0 commit comments

Comments
 (0)