From d5e149201ccc659fca7064d3fa39160d9c2bc80f Mon Sep 17 00:00:00 2001 From: Martin Michaelis Date: Fri, 6 Oct 2017 11:50:47 -0700 Subject: [PATCH 1/4] doc: fix inconsistent documentation of server.listen() The `net`, `tls`, `http` and `https` module have the same `server.listen()` method, but have a different documenation. Changed to a consistent link to the documentation of the `net` module. --- doc/api/http.md | 81 ++---------------------------------------------- doc/api/https.md | 18 +++-------- doc/api/tls.md | 23 ++------------ 3 files changed, 10 insertions(+), 112 deletions(-) diff --git a/doc/api/http.md b/doc/api/http.md index 281569b40a0c05..2c37a07cdd0337 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -841,85 +841,9 @@ added: v0.1.90 Stops the server from accepting new connections. See [`net.Server.close()`][]. -### server.listen(handle[, callback]) - - -* `handle` {Object} -* `callback` {Function} - -The `handle` object can be set to either a server or socket (anything -with an underlying `_handle` member), or a `{fd: }` object. - -This will cause the server to accept connections on the specified -handle, but it is presumed that the file descriptor or handle has -already been bound to a port or domain socket. - -Listening on a file descriptor is not supported on Windows. - -This function is asynchronous. `callback` will be added as a listener for the -[`'listening'`][] event. See also [`net.Server.listen()`][]. - -Returns `server`. - -*Note*: The `server.listen()` method can be called again if and only if there was an error -during the first `server.listen()` call or `server.close()` has been called. -Otherwise, an `ERR_SERVER_ALREADY_LISTEN` error will be thrown. - -### server.listen(path[, callback]) - - -* `path` {string} -* `callback` {Function} - -Start a UNIX socket server listening for connections on the given `path`. - -This function is asynchronous. `callback` will be added as a listener for the -[`'listening'`][] event. See also [`net.Server.listen(path)`][]. - -*Note*: The `server.listen()` method can be called again if and only if there was an error -during the first `server.listen()` call or `server.close()` has been called. -Otherwise, an `ERR_SERVER_ALREADY_LISTEN` error will be thrown. - -### server.listen([port][, hostname][, backlog][, callback]) - - -* `port` {number} -* `hostname` {string} -* `backlog` {number} -* `callback` {Function} - -Begin accepting connections on the specified `port` and `hostname`. If the -`hostname` is omitted, the server will accept connections on the -[unspecified IPv6 address][] (`::`) when IPv6 is available, or the -[unspecified IPv4 address][] (`0.0.0.0`) otherwise. - -*Note*: In most operating systems, listening to the -[unspecified IPv6 address][] (`::`) may cause the `net.Server` to also listen on -the [unspecified IPv4 address][] (`0.0.0.0`). - -Omit the port argument, or use a port value of `0`, to have the operating system -assign a random port, which can be retrieved by using `server.address().port` -after the `'listening'` event has been emitted. - -To listen to a unix socket, supply a filename instead of port and hostname. - -`backlog` is the maximum length of the queue of pending connections. -The actual length will be determined by the OS through sysctl settings such as -`tcp_max_syn_backlog` and `somaxconn` on linux. The default value of this -parameter is 511 (not 512). - -This function is asynchronous. `callback` will be added as a listener for the -[`'listening'`][] event. See also [`net.Server.listen(port)`][]. +### server.listen() -*Note*: The `server.listen()` method can be called again if and only if there was an error -during the first `server.listen()` call or `server.close()` has been called. -Otherwise, an `ERR_SERVER_ALREADY_LISTEN` error will be thrown. +Start a server listening for connections. This method is identical to [`server.listen()`][] from [`net.Server`][]. ### server.listening - -* `port` {number} The TCP/IP port on which to begin listening for connections. - A value of `0` (zero) will assign a random port. -* `hostname` {string} The hostname, IPv4, or IPv6 address on which to begin - listening for connections. If `undefined`, the server will accept connections - on any IPv6 address (`::`) when IPv6 is available, or any IPv4 address - (`0.0.0.0`) otherwise. -* `callback` {Function} A callback function to be invoked when the server has - begun listening on the `port` and `hostname`. - -The `server.listen()` methods instructs the server to begin accepting -connections on the specified `port` and `hostname`. - -This function operates asynchronously. If the `callback` is given, it will be -called when the server has started listening. +### server.listen() -See [`net.Server`][] for more information. +Start a server listening for connections. This method is identical to [`server.listen()`][] from [`net.Server`][]. ### server.setTicketKeys(keys) +- `callback` {Function} + +See [`http.close()`][] for details. + +### server.listen() + +Start a server listening for connections. This method is identical to [`server.listen()`][] from [`net.Server`][]. + ### server.setTimeout([msecs][, callback]) -- `callback` {Function} - -See [`http.close()`][] for details. - -### server.listen() - -Start a server listening for connections. This method is identical to [`server.listen()`][] from [`net.Server`][]. - ## https.get(options[, callback]) - `callback` {Function} -See [`http.close()`][] for details. +See [`server.close()`][`http.close()`] from the HTTP module for details. ### server.listen()