Skip to content

Commit d750fc6

Browse files
lpincaMylesBorins
authored andcommitted
doc: add added: information for dgram
Ref: #8883 PR-URL: #8196 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent b92e3fc commit d750fc6

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(buf, offset, length, port, address[, callback])
223+
<!-- YAML
224+
added: v0.1.99
225+
-->
196226

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

279309
### socket.setMulticastLoopback(flag)
310+
<!-- YAML
311+
added: v0.3.8
312+
-->
280313

281314
* `flag` {Boolean}
282315

283316
Sets or clears the `IP_MULTICAST_LOOP` socket option. When set to `true`,
284317
multicast packets will also be received on the local interface.
285318

286319
### socket.setMulticastTTL(ttl)
320+
<!-- YAML
321+
added: v0.3.8
322+
-->
287323

288324
* `ttl` {Number} Integer
289325

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

299335
### socket.setTTL(ttl)
336+
<!-- YAML
337+
added: v0.1.101
338+
-->
300339

301340
* `ttl` {Number} Integer
302341

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

312351
### socket.ref()
352+
<!-- YAML
353+
added: v0.9.1
354+
-->
313355

314356
By default, binding a socket will cause it to block the Node.js process from
315357
exiting as long as the socket is open. The `socket.unref()` method can be used
@@ -323,6 +365,9 @@ The `socket.ref()` method returns a reference to the socket so calls can be
323365
chained.
324366

325367
### socket.unref()
368+
<!-- YAML
369+
added: v0.9.1
370+
-->
326371

327372
By default, binding a socket will cause it to block the Node.js process from
328373
exiting as long as the socket is open. The `socket.unref()` method can be used
@@ -360,6 +405,9 @@ s.bind(1234, () => {
360405
## `dgram` module functions
361406

362407
### dgram.createSocket(options[, callback])
408+
<!-- YAML
409+
added: v0.11.13
410+
-->
363411

364412
* `options` {Object}
365413
* `callback` {Function} Attached as a listener to `'message'` events.
@@ -382,6 +430,9 @@ and `udp6` sockets). The bound address and port can be retrieved using
382430
[`socket.address().address`][] and [`socket.address().port`][].
383431

384432
### dgram.createSocket(type[, callback])
433+
<!-- YAML
434+
added: v0.1.99
435+
-->
385436

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

0 commit comments

Comments
 (0)