Skip to content

Commit 9e1b7aa

Browse files
jscissrcjihrig
authored andcommitted
doc: document backlog for server.listen() variants
The backlog parameter is supported by all variations of net.Server.listen(), but wasn't consistently documented. This commit brings the documentation into a more consistent state. Refs: #4056 PR-URL: #4025 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
1 parent d63ccee commit 9e1b7aa

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

doc/api/net.markdown

+13-5
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ when sockets were sent to forks.
8383

8484
Callback should take two arguments `err` and `count`.
8585

86-
### server.listen(handle[, callback])
86+
### server.listen(handle[, backlog][, callback])
8787

8888
* `handle` {Object}
89+
* `backlog` {Number}
8990
* `callback` {Function}
9091

9192
The `handle` object can be set to either a server or socket (anything
@@ -102,6 +103,9 @@ This function is asynchronous. When the server has been bound,
102103
The last parameter `callback` will be added as a listener for the
103104
[`'listening'`][] event.
104105

106+
The parameter `backlog` behaves the same as in
107+
[`server.listen(port, \[host\], \[backlog\], \[callback\])`][].
108+
105109
### server.listen(options[, callback])
106110

107111
* `options` {Object} - Required. Supports the following properties:
@@ -114,9 +118,8 @@ The last parameter `callback` will be added as a listener for the
114118

115119
The `port`, `host`, and `backlog` properties of `options`, as well as the
116120
optional callback function, behave as they do on a call to
117-
[server.listen(port, \[host\], \[backlog\], \[callback\])
118-
](#net_server_listen_port_hostname_backlog_callback). Alternatively, the `path`
119-
option can be used to specify a UNIX socket.
121+
[`server.listen(port, \[host\], \[backlog\], \[callback\])`][]. Alternatively,
122+
the `path` option can be used to specify a UNIX socket.
120123

121124
If `exclusive` is `false` (default), then cluster workers will use the same
122125
underlying handle, allowing connection handling duties to be shared. When
@@ -130,9 +133,10 @@ shown below.
130133
exclusive: true
131134
});
132135

133-
### server.listen(path[, callback])
136+
### server.listen(path[, backlog][, callback])
134137

135138
* `path` {String}
139+
* `backlog` {Number}
136140
* `callback` {Function}
137141

138142
Start a local socket server listening for connections on the given `path`.
@@ -157,6 +161,9 @@ double-backslashes, such as:
157161
net.createServer().listen(
158162
path.join('\\\\?\\pipe', process.cwd(), 'myctl'))
159163

164+
The parameter `backlog` behaves the same as in
165+
[`server.listen(port, \[host\], \[backlog\], \[callback\])`][].
166+
160167
### server.listen(port[, hostname][, backlog][, callback])
161168

162169
Begin accepting connections on the specified `port` and `hostname`. If the
@@ -677,6 +684,7 @@ Returns true if input is a version 6 IP address, otherwise returns false.
677684
[`pause()`]: #net_socket_pause
678685
[`resume()`]: #net_socket_resume
679686
[`server.getConnections`]: #net_server_getconnections_callback
687+
[`server.listen(port, \[host\], \[backlog\], \[callback\])`]: #net_server_listen_port_hostname_backlog_callback
680688
[`socket.connect(options\[, connectListener\])`]: #net_socket_connect_options_connectlistener
681689
[`socket.connect`]: #net_socket_connect_options_connectlistener
682690
[`socket.setTimeout()`]: #net_socket_settimeout_timeout_callback

0 commit comments

Comments
 (0)