@@ -29,6 +29,9 @@ server.bind(41234);
2929```
3030
3131## Class: dgram.Socket
32+ <!-- YAML
33+ added: v0.1.99
34+ -->
3235
3336The ` dgram.Socket ` object is an [ ` EventEmitter ` ] [ ] that encapsulates the
3437datagram functionality.
@@ -37,23 +40,35 @@ New instances of `dgram.Socket` are created using [`dgram.createSocket()`][].
3740The ` 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
4147The ` 'close' ` event is emitted after a socket is closed with [ ` close() ` ] [ ] .
4248Once 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
4857The ` 'error' ` event is emitted whenever any error occurs. The event handler
4958function is passed a single Error object.
5059
5160### Event: 'listening'
61+ <!-- YAML
62+ added: v0.1.99
63+ -->
5264
5365The ` 'listening' ` event is emitted whenever a socket begins listening for
5466datagram 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
85100available interface, call ` addMembership ` multiple times, once per interface.
86101
87102### socket.address()
103+ <!-- YAML
104+ added: v0.1.99
105+ -->
88106
89107Returns an object containing the address information for a socket.
90108For UDP sockets, this object will contain ` address ` , ` family ` and ` port `
91109properties.
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
176203Close the underlying socket and stop listening for data on it. If a callback is
177204provided, 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
193220drop 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
300330packets 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
306339Sets or clears the ` IP_MULTICAST_LOOP ` socket option. When set to ` true ` ,
307340multicast 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
320356between 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.
333372The default on most systems is 64 but can vary.
334373
335374### socket.ref()
375+ <!-- YAML
376+ added: v0.9.1
377+ -->
336378
337379By default, binding a socket will cause it to block the Node.js process from
338380exiting 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
346388chained.
347389
348390### socket.unref()
391+ <!-- YAML
392+ added: v0.9.1
393+ -->
349394
350395By default, binding a socket will cause it to block the Node.js process from
351396exiting 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