Skip to content

Commit

Permalink
doc,dgram: use code markup/markdown in headers
Browse files Browse the repository at this point in the history
Backport-PR-URL: #31108
PR-URL: #31086
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
Trott authored and BethGriggs committed Feb 6, 2020
1 parent 448a117 commit c2ad43a
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions doc/api/dgram.md
Expand Up @@ -30,7 +30,7 @@ server.bind(41234);
// Prints: server listening 0.0.0.0:41234
```

## Class: dgram.Socket
## Class: `dgram.Socket`
<!-- YAML
added: v0.1.99
-->
Expand All @@ -42,23 +42,23 @@ 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'`
<!-- YAML
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'`
<!-- YAML
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'`
<!-- YAML
added: v0.1.99
-->
Expand All @@ -68,15 +68,15 @@ 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'`
<!-- YAML
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'`
<!-- YAML
added: v0.1.99
-->
Expand All @@ -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])`
<!-- YAML
added: v0.6.9
-->
Expand Down Expand Up @@ -123,7 +123,7 @@ if (cluster.isMaster) {
}
```

### socket.address()
### `socket.address()`
<!-- YAML
added: v0.1.99
-->
Expand All @@ -134,7 +134,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])`
<!-- YAML
added: v0.1.99
changes:
Expand Down Expand Up @@ -190,7 +190,7 @@ server.bind(41234);
// Prints: server listening 0.0.0.0:41234
```

### socket.bind(options\[, callback\])
### `socket.bind(options[, callback])`
<!-- YAML
added: v0.11.14
-->
Expand Down Expand Up @@ -243,7 +243,7 @@ socket.bind({
});
```

### socket.close(\[callback\])
### `socket.close([callback])`
<!-- YAML
added: v0.1.99
-->
Expand All @@ -253,7 +253,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])`
<!-- YAML
added: v12.0.0
-->
Expand All @@ -272,7 +272,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()`
<!-- YAML
added: v12.0.0
-->
Expand All @@ -281,7 +281,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])`
<!-- YAML
added: v0.6.9
-->
Expand All @@ -297,21 +297,21 @@ never have 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()`
<!-- YAML
added: v8.7.0
-->

* Returns: {number} the `SO_RCVBUF` socket receive buffer size in bytes.

### socket.getSendBufferSize()
### `socket.getSendBufferSize()`
<!-- YAML
added: v8.7.0
-->

* Returns: {number} the `SO_SNDBUF` socket send buffer size in bytes.

### socket.ref()
### `socket.ref()`
<!-- YAML
added: v0.9.1
-->
Expand All @@ -329,7 +329,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()`
<!-- YAML
added: v12.0.0
-->
Expand All @@ -340,7 +340,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])`
<!-- YAML
added: v0.1.99
changes:
Expand Down Expand Up @@ -478,7 +478,7 @@ a packet might travel. Sending a datagram greater than the receiver `MTU` will
not work because the packet will get silently dropped without informing the
source that the data did not reach its intended recipient.

### socket.setBroadcast(flag)
### `socket.setBroadcast(flag)`
<!-- YAML
added: v0.6.9
-->
Expand All @@ -488,7 +488,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)`
<!-- YAML
added: v8.6.0
-->
Expand Down Expand Up @@ -566,7 +566,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)`
<!-- YAML
added: v0.3.8
-->
Expand All @@ -576,7 +576,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)`
<!-- YAML
added: v0.3.8
-->
Expand All @@ -591,7 +591,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)`
<!-- YAML
added: v8.7.0
-->
Expand All @@ -601,7 +601,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)`
<!-- YAML
added: v8.7.0
-->
Expand All @@ -611,7 +611,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)`
<!-- YAML
added: v0.1.101
-->
Expand All @@ -627,7 +627,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()`
<!-- YAML
added: v0.9.1
-->
Expand All @@ -647,7 +647,7 @@ chained.

## `dgram` module functions

### dgram.createSocket(options\[, callback\])
### `dgram.createSocket(options[, callback])`
<!-- YAML
added: v0.11.13
changes:
Expand Down Expand Up @@ -686,7 +686,7 @@ method will bind the socket to the "all interfaces" address on a random port
and port can be retrieved using [`socket.address().address`][] and
[`socket.address().port`][].

### dgram.createSocket(type\[, callback\])
### `dgram.createSocket(type[, callback])`
<!-- YAML
added: v0.1.99
-->
Expand Down

0 comments on commit c2ad43a

Please sign in to comment.