diff --git a/doc/api/dgram.md b/doc/api/dgram.md index 6499282d05361c..dc82f6dc581f25 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -30,7 +30,7 @@ server.bind(41234); // Prints: server listening 0.0.0.0:41234 ``` -## Class: dgram.Socket +## Class: `dgram.Socket` @@ -42,7 +42,7 @@ Encapsulates the datagram functionality. New instances of `dgram.Socket` are created using [`dgram.createSocket()`][]. The `new` keyword is not to be used to create `dgram.Socket` instances. -### Event: 'close' +### Event: `'close'` @@ -50,7 +50,7 @@ added: v0.1.99 The `'close'` event is emitted after a socket is closed with [`close()`][]. Once triggered, no new `'message'` events will be emitted on this socket. -### Event: 'connect' +### Event: `'connect'` @@ -58,7 +58,7 @@ added: v12.0.0 The `'connect'` event is emitted after a socket is associated to a remote address as a result of a successful [`connect()`][] call. -### Event: 'error' +### Event: `'error'` @@ -68,7 +68,7 @@ added: v0.1.99 The `'error'` event is emitted whenever any error occurs. The event handler function is passed a single `Error` object. -### Event: 'listening' +### Event: `'listening'` @@ -76,7 +76,7 @@ added: v0.1.99 The `'listening'` event is emitted whenever a socket begins listening for datagram messages. This occurs as soon as UDP sockets are created. -### Event: 'message' +### Event: `'message'` @@ -91,7 +91,7 @@ The event handler function is passed two arguments: `msg` and `rinfo`. * `port` {number} The sender port. * `size` {number} The message size. -### socket.addMembership(multicastAddress\[, multicastInterface\]) +### `socket.addMembership(multicastAddress[, multicastInterface])` @@ -123,7 +123,7 @@ if (cluster.isMaster) { } ``` -### socket.addSourceSpecificMembership(sourceAddress, groupAddress\[, multicastInterface\]) +### `socket.addSourceSpecificMembership(sourceAddress, groupAddress[, multicastInterface])` @@ -138,7 +138,7 @@ is not specified, the operating system will choose one interface and will add membership to it. To add membership to every available interface, call `socket.addSourceSpecificMembership()` multiple times, once per interface. -### socket.address() +### `socket.address()` @@ -149,7 +149,7 @@ Returns an object containing the address information for a socket. For UDP sockets, this object will contain `address`, `family` and `port` properties. -### socket.bind(\[port\]\[, address\]\[, callback\]) +### `socket.bind([port][, address][, callback])` @@ -258,7 +258,7 @@ socket.bind({ }); ``` -### socket.close(\[callback\]) +### `socket.close([callback])` @@ -268,7 +268,7 @@ added: v0.1.99 Close the underlying socket and stop listening for data on it. If a callback is provided, it is added as a listener for the [`'close'`][] event. -### socket.connect(port\[, address\]\[, callback\]) +### `socket.connect(port[, address][, callback])` @@ -287,7 +287,7 @@ will be used by default. Once the connection is complete, a `'connect'` event is emitted and the optional `callback` function is called. In case of failure, the `callback` is called or, failing this, an `'error'` event is emitted. -### socket.disconnect() +### `socket.disconnect()` @@ -296,7 +296,7 @@ A synchronous function that disassociates a connected `dgram.Socket` from its remote address. Trying to call `disconnect()` on an already disconnected socket will result in an [`ERR_SOCKET_DGRAM_NOT_CONNECTED`][] exception. -### socket.dropMembership(multicastAddress\[, multicastInterface\]) +### `socket.dropMembership(multicastAddress[, multicastInterface])` @@ -312,7 +312,7 @@ never have reason to call this. If `multicastInterface` is not specified, the operating system will attempt to drop membership on all valid interfaces. -### socket.dropSourceSpecificMembership(sourceAddress, groupAddress\[, multicastInterface\]) +### `socket.dropSourceSpecificMembership(sourceAddress, groupAddress[, multicastInterface])` @@ -330,21 +330,21 @@ reason to call this. If `multicastInterface` is not specified, the operating system will attempt to drop membership on all valid interfaces. -### socket.getRecvBufferSize() +### `socket.getRecvBufferSize()` * Returns: {number} the `SO_RCVBUF` socket receive buffer size in bytes. -### socket.getSendBufferSize() +### `socket.getSendBufferSize()` * Returns: {number} the `SO_SNDBUF` socket send buffer size in bytes. -### socket.ref() +### `socket.ref()` @@ -362,7 +362,7 @@ Calling `socket.ref()` multiples times will have no additional effect. The `socket.ref()` method returns a reference to the socket so calls can be chained. -### socket.remoteAddress() +### `socket.remoteAddress()` @@ -373,7 +373,7 @@ Returns an object containing the `address`, `family`, and `port` of the remote endpoint. It throws an [`ERR_SOCKET_DGRAM_NOT_CONNECTED`][] exception if the socket is not connected. -### socket.send(msg\[, offset, length\]\[, port\]\[, address\]\[, callback\]) +### `socket.send(msg[, offset, length][, port][, address][, callback])` @@ -521,7 +521,7 @@ added: v0.6.9 Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP packets may be sent to a local interface's broadcast address. -### socket.setMulticastInterface(multicastInterface) +### `socket.setMulticastInterface(multicastInterface)` @@ -599,7 +599,7 @@ A socket's address family's ANY address (IPv4 `'0.0.0.0'` or IPv6 `'::'`) can be used to return control of the sockets default outgoing interface to the system for future multicast packets. -### socket.setMulticastLoopback(flag) +### `socket.setMulticastLoopback(flag)` @@ -609,7 +609,7 @@ added: v0.3.8 Sets or clears the `IP_MULTICAST_LOOP` socket option. When set to `true`, multicast packets will also be received on the local interface. -### socket.setMulticastTTL(ttl) +### `socket.setMulticastTTL(ttl)` @@ -624,7 +624,7 @@ decremented to 0 by a router, it will not be forwarded. The `ttl` argument may be between 0 and 255. The default on most systems is `1`. -### socket.setRecvBufferSize(size) +### `socket.setRecvBufferSize(size)` @@ -634,7 +634,7 @@ added: v8.7.0 Sets the `SO_RCVBUF` socket option. Sets the maximum socket receive buffer in bytes. -### socket.setSendBufferSize(size) +### `socket.setSendBufferSize(size)` @@ -644,7 +644,7 @@ added: v8.7.0 Sets the `SO_SNDBUF` socket option. Sets the maximum socket send buffer in bytes. -### socket.setTTL(ttl) +### `socket.setTTL(ttl)` @@ -660,7 +660,7 @@ Changing TTL values is typically done for network probes or when multicasting. The `ttl` argument may be between between 1 and 255. The default on most systems is 64. -### socket.unref() +### `socket.unref()` @@ -680,7 +680,7 @@ chained. ## `dgram` module functions -### dgram.createSocket(options\[, callback\]) +### `dgram.createSocket(options[, callback])`