@@ -30,7 +30,7 @@ server.bind(41234);
30
30
// Prints: server listening 0.0.0.0:41234
31
31
```
32
32
33
- ## Class: dgram.Socket
33
+ ## Class: ` dgram.Socket `
34
34
<!-- YAML
35
35
added: v0.1.99
36
36
-->
@@ -42,23 +42,23 @@ Encapsulates the datagram functionality.
42
42
New instances of ` dgram.Socket ` are created using [ ` dgram.createSocket() ` ] [ ] .
43
43
The ` new ` keyword is not to be used to create ` dgram.Socket ` instances.
44
44
45
- ### Event: 'close'
45
+ ### Event: ` 'close' `
46
46
<!-- YAML
47
47
added: v0.1.99
48
48
-->
49
49
50
50
The ` 'close' ` event is emitted after a socket is closed with [ ` close() ` ] [ ] .
51
51
Once triggered, no new ` 'message' ` events will be emitted on this socket.
52
52
53
- ### Event: 'connect'
53
+ ### Event: ` 'connect' `
54
54
<!-- YAML
55
55
added: v12.0.0
56
56
-->
57
57
58
58
The ` 'connect' ` event is emitted after a socket is associated to a remote
59
59
address as a result of a successful [ ` connect() ` ] [ ] call.
60
60
61
- ### Event: 'error'
61
+ ### Event: ` 'error' `
62
62
<!-- YAML
63
63
added: v0.1.99
64
64
-->
@@ -68,15 +68,15 @@ added: v0.1.99
68
68
The ` 'error' ` event is emitted whenever any error occurs. The event handler
69
69
function is passed a single ` Error ` object.
70
70
71
- ### Event: 'listening'
71
+ ### Event: ` 'listening' `
72
72
<!-- YAML
73
73
added: v0.1.99
74
74
-->
75
75
76
76
The ` 'listening' ` event is emitted whenever a socket begins listening for
77
77
datagram messages. This occurs as soon as UDP sockets are created.
78
78
79
- ### Event: 'message'
79
+ ### Event: ` 'message' `
80
80
<!-- YAML
81
81
added: v0.1.99
82
82
-->
@@ -91,7 +91,7 @@ The event handler function is passed two arguments: `msg` and `rinfo`.
91
91
* ` port ` {number} The sender port.
92
92
* ` size ` {number} The message size.
93
93
94
- ### socket.addMembership(multicastAddress\ [ , multicastInterface\] )
94
+ ### ` socket.addMembership(multicastAddress[, multicastInterface]) `
95
95
<!-- YAML
96
96
added: v0.6.9
97
97
-->
@@ -123,7 +123,7 @@ if (cluster.isMaster) {
123
123
}
124
124
```
125
125
126
- ### socket.address()
126
+ ### ` socket.address() `
127
127
<!-- YAML
128
128
added: v0.1.99
129
129
-->
@@ -134,7 +134,7 @@ Returns an object containing the address information for a socket.
134
134
For UDP sockets, this object will contain ` address ` , ` family ` and ` port `
135
135
properties.
136
136
137
- ### socket.bind(\ [ port\]\ [ , address\]\ [ , callback\] )
137
+ ### ` socket.bind([port] [, address] [, callback]) `
138
138
<!-- YAML
139
139
added: v0.1.99
140
140
changes:
@@ -190,7 +190,7 @@ server.bind(41234);
190
190
// Prints: server listening 0.0.0.0:41234
191
191
```
192
192
193
- ### socket.bind(options\ [ , callback\] )
193
+ ### ` socket.bind(options[, callback]) `
194
194
<!-- YAML
195
195
added: v0.11.14
196
196
-->
@@ -243,7 +243,7 @@ socket.bind({
243
243
});
244
244
```
245
245
246
- ### socket.close(\ [ callback\] )
246
+ ### ` socket.close([callback]) `
247
247
<!-- YAML
248
248
added: v0.1.99
249
249
-->
@@ -253,7 +253,7 @@ added: v0.1.99
253
253
Close the underlying socket and stop listening for data on it. If a callback is
254
254
provided, it is added as a listener for the [ ` 'close' ` ] [ ] event.
255
255
256
- ### socket.connect(port\ [ , address\]\ [ , callback\] )
256
+ ### ` socket.connect(port[, address] [, callback]) `
257
257
<!-- YAML
258
258
added: v12.0.0
259
259
-->
@@ -272,7 +272,7 @@ will be used by default. Once the connection is complete, a `'connect'` event
272
272
is emitted and the optional ` callback ` function is called. In case of failure,
273
273
the ` callback ` is called or, failing this, an ` 'error' ` event is emitted.
274
274
275
- ### socket.disconnect()
275
+ ### ` socket.disconnect() `
276
276
<!-- YAML
277
277
added: v12.0.0
278
278
-->
@@ -281,7 +281,7 @@ A synchronous function that disassociates a connected `dgram.Socket` from
281
281
its remote address. Trying to call ` disconnect() ` on an already disconnected
282
282
socket will result in an [ ` ERR_SOCKET_DGRAM_NOT_CONNECTED ` ] [ ] exception.
283
283
284
- ### socket.dropMembership(multicastAddress\ [ , multicastInterface\] )
284
+ ### ` socket.dropMembership(multicastAddress[, multicastInterface]) `
285
285
<!-- YAML
286
286
added: v0.6.9
287
287
-->
@@ -297,21 +297,21 @@ never have reason to call this.
297
297
If ` multicastInterface ` is not specified, the operating system will attempt to
298
298
drop membership on all valid interfaces.
299
299
300
- ### socket.getRecvBufferSize()
300
+ ### ` socket.getRecvBufferSize() `
301
301
<!-- YAML
302
302
added: v8.7.0
303
303
-->
304
304
305
305
* Returns: {number} the ` SO_RCVBUF ` socket receive buffer size in bytes.
306
306
307
- ### socket.getSendBufferSize()
307
+ ### ` socket.getSendBufferSize() `
308
308
<!-- YAML
309
309
added: v8.7.0
310
310
-->
311
311
312
312
* Returns: {number} the ` SO_SNDBUF ` socket send buffer size in bytes.
313
313
314
- ### socket.ref()
314
+ ### ` socket.ref() `
315
315
<!-- YAML
316
316
added: v0.9.1
317
317
-->
@@ -329,7 +329,7 @@ Calling `socket.ref()` multiples times will have no additional effect.
329
329
The ` socket.ref() ` method returns a reference to the socket so calls can be
330
330
chained.
331
331
332
- ### socket.remoteAddress()
332
+ ### ` socket.remoteAddress() `
333
333
<!-- YAML
334
334
added: v12.0.0
335
335
-->
@@ -340,7 +340,7 @@ Returns an object containing the `address`, `family`, and `port` of the remote
340
340
endpoint. It throws an [ ` ERR_SOCKET_DGRAM_NOT_CONNECTED ` ] [ ] exception if the
341
341
socket is not connected.
342
342
343
- ### socket.send(msg\ [ , offset, length\]\ [ , port\]\ [ , address\]\ [ , callback\] )
343
+ ### ` socket.send(msg[, offset, length] [, port] [, address] [, callback]) `
344
344
<!-- YAML
345
345
added: v0.1.99
346
346
changes:
@@ -478,7 +478,7 @@ a packet might travel. Sending a datagram greater than the receiver `MTU` will
478
478
not work because the packet will get silently dropped without informing the
479
479
source that the data did not reach its intended recipient.
480
480
481
- ### socket.setBroadcast(flag)
481
+ ### ` socket.setBroadcast(flag) `
482
482
<!-- YAML
483
483
added: v0.6.9
484
484
-->
@@ -488,7 +488,7 @@ added: v0.6.9
488
488
Sets or clears the ` SO_BROADCAST ` socket option. When set to ` true ` , UDP
489
489
packets may be sent to a local interface's broadcast address.
490
490
491
- ### socket.setMulticastInterface(multicastInterface)
491
+ ### ` socket.setMulticastInterface(multicastInterface) `
492
492
<!-- YAML
493
493
added: v8.6.0
494
494
-->
@@ -566,7 +566,7 @@ A socket's address family's ANY address (IPv4 `'0.0.0.0'` or IPv6 `'::'`) can be
566
566
used to return control of the sockets default outgoing interface to the system
567
567
for future multicast packets.
568
568
569
- ### socket.setMulticastLoopback(flag)
569
+ ### ` socket.setMulticastLoopback(flag) `
570
570
<!-- YAML
571
571
added: v0.3.8
572
572
-->
@@ -576,7 +576,7 @@ added: v0.3.8
576
576
Sets or clears the ` IP_MULTICAST_LOOP ` socket option. When set to ` true ` ,
577
577
multicast packets will also be received on the local interface.
578
578
579
- ### socket.setMulticastTTL(ttl)
579
+ ### ` socket.setMulticastTTL(ttl) `
580
580
<!-- YAML
581
581
added: v0.3.8
582
582
-->
@@ -591,7 +591,7 @@ decremented to 0 by a router, it will not be forwarded.
591
591
592
592
The ` ttl ` argument may be between 0 and 255. The default on most systems is ` 1 ` .
593
593
594
- ### socket.setRecvBufferSize(size)
594
+ ### ` socket.setRecvBufferSize(size) `
595
595
<!-- YAML
596
596
added: v8.7.0
597
597
-->
@@ -601,7 +601,7 @@ added: v8.7.0
601
601
Sets the ` SO_RCVBUF ` socket option. Sets the maximum socket receive buffer
602
602
in bytes.
603
603
604
- ### socket.setSendBufferSize(size)
604
+ ### ` socket.setSendBufferSize(size) `
605
605
<!-- YAML
606
606
added: v8.7.0
607
607
-->
@@ -611,7 +611,7 @@ added: v8.7.0
611
611
Sets the ` SO_SNDBUF ` socket option. Sets the maximum socket send buffer
612
612
in bytes.
613
613
614
- ### socket.setTTL(ttl)
614
+ ### ` socket.setTTL(ttl) `
615
615
<!-- YAML
616
616
added: v0.1.101
617
617
-->
@@ -627,7 +627,7 @@ Changing TTL values is typically done for network probes or when multicasting.
627
627
The ` ttl ` argument may be between between 1 and 255. The default on most systems
628
628
is 64.
629
629
630
- ### socket.unref()
630
+ ### ` socket.unref() `
631
631
<!-- YAML
632
632
added: v0.9.1
633
633
-->
@@ -647,7 +647,7 @@ chained.
647
647
648
648
## ` dgram ` module functions
649
649
650
- ### dgram.createSocket(options\ [ , callback\] )
650
+ ### ` dgram.createSocket(options[, callback]) `
651
651
<!-- YAML
652
652
added: v0.11.13
653
653
changes:
@@ -686,7 +686,7 @@ method will bind the socket to the "all interfaces" address on a random port
686
686
and port can be retrieved using [ ` socket.address().address ` ] [ ] and
687
687
[ ` socket.address().port ` ] [ ] .
688
688
689
- ### dgram.createSocket(type\ [ , callback\] )
689
+ ### ` dgram.createSocket(type[, callback]) `
690
690
<!-- YAML
691
691
added: v0.1.99
692
692
-->
0 commit comments