Skip to content

Commit

Permalink
doc,dgram: use code markup/markdown in headers
Browse files Browse the repository at this point in the history
PR-URL: #31086
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
  • Loading branch information
Trott authored and BridgeAR committed Jan 3, 2020
1 parent 7afe69c commit 4a42230
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions doc/api/dgram.md
Original file line number Diff line number Diff line change
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.addSourceSpecificMembership(sourceAddress, groupAddress\[, multicastInterface\])
### `socket.addSourceSpecificMembership(sourceAddress, groupAddress[, multicastInterface])`
<!-- YAML
added: v13.1.0
-->
Expand All @@ -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()`
<!-- YAML
added: v0.1.99
-->
Expand All @@ -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])`
<!-- YAML
added: v0.1.99
changes:
Expand Down Expand Up @@ -205,7 +205,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 @@ -258,7 +258,7 @@ socket.bind({
});
```

### socket.close(\[callback\])
### `socket.close([callback])`
<!-- YAML
added: v0.1.99
-->
Expand All @@ -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])`
<!-- YAML
added: v12.0.0
-->
Expand All @@ -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()`
<!-- YAML
added: v12.0.0
-->
Expand All @@ -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])`
<!-- YAML
added: v0.6.9
-->
Expand All @@ -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])`
<!-- YAML
added: v13.1.0
-->
Expand All @@ -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()`
<!-- 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 @@ -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()`
<!-- YAML
added: v12.0.0
-->
Expand All @@ -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])`
<!-- YAML
added: v0.1.99
changes:
Expand Down Expand Up @@ -511,7 +511,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 @@ -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)`
<!-- YAML
added: v8.6.0
-->
Expand Down Expand Up @@ -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)`
<!-- YAML
added: v0.3.8
-->
Expand All @@ -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)`
<!-- YAML
added: v0.3.8
-->
Expand All @@ -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)`
<!-- YAML
added: v8.7.0
-->
Expand All @@ -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)`
<!-- YAML
added: v8.7.0
-->
Expand All @@ -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)`
<!-- YAML
added: v0.1.101
-->
Expand All @@ -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()`
<!-- YAML
added: v0.9.1
-->
Expand All @@ -680,7 +680,7 @@ chained.

## `dgram` module functions

### dgram.createSocket(options\[, callback\])
### `dgram.createSocket(options[, callback])`
<!-- YAML
added: v0.11.13
changes:
Expand Down Expand Up @@ -719,7 +719,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 4a42230

Please sign in to comment.