@@ -841,85 +841,10 @@ added: v0.1.90
841841
842842Stops the server from accepting new connections. See [ ` net.Server.close() ` ] [ ] .
843843
844- ### server.listen(handle[ , callback] )
845- <!-- YAML
846- added: v0.5.10
847- -->
848-
849- * ` handle ` {Object}
850- * ` callback ` {Function}
851-
852- The ` handle ` object can be set to either a server or socket (anything
853- with an underlying ` _handle ` member), or a ` {fd: <n>} ` object.
854-
855- This will cause the server to accept connections on the specified
856- handle, but it is presumed that the file descriptor or handle has
857- already been bound to a port or domain socket.
858-
859- Listening on a file descriptor is not supported on Windows.
860-
861- This function is asynchronous. ` callback ` will be added as a listener for the
862- [ ` 'listening' ` ] [ ] event. See also [ ` net.Server.listen() ` ] [ ] .
863-
864- Returns ` server ` .
865-
866- * Note* : The ` server.listen() ` method can be called again if and only if there was an error
867- during the first ` server.listen() ` call or ` server.close() ` has been called.
868- Otherwise, an ` ERR_SERVER_ALREADY_LISTEN ` error will be thrown.
869-
870- ### server.listen(path[ , callback] )
871- <!-- YAML
872- added: v0.1.90
873- -->
874-
875- * ` path ` {string}
876- * ` callback ` {Function}
877-
878- Start a UNIX socket server listening for connections on the given ` path ` .
879-
880- This function is asynchronous. ` callback ` will be added as a listener for the
881- [ ` 'listening' ` ] [ ] event. See also [ ` net.Server.listen(path) ` ] [ ] .
882-
883- * Note* : The ` server.listen() ` method can be called again if and only if there was an error
884- during the first ` server.listen() ` call or ` server.close() ` has been called.
885- Otherwise, an ` ERR_SERVER_ALREADY_LISTEN ` error will be thrown.
886-
887- ### server.listen([ port] [ , hostname ] [ , backlog] [ , callback ] )
888- <!-- YAML
889- added: v0.1.90
890- -->
891-
892- * ` port ` {number}
893- * ` hostname ` {string}
894- * ` backlog ` {number}
895- * ` callback ` {Function}
896-
897- Begin accepting connections on the specified ` port ` and ` hostname ` . If the
898- ` hostname ` is omitted, the server will accept connections on the
899- [ unspecified IPv6 address] [ ] (` :: ` ) when IPv6 is available, or the
900- [ unspecified IPv4 address] [ ] (` 0.0.0.0 ` ) otherwise.
901-
902- * Note* : In most operating systems, listening to the
903- [ unspecified IPv6 address] [ ] (` :: ` ) may cause the ` net.Server ` to also listen on
904- the [ unspecified IPv4 address] [ ] (` 0.0.0.0 ` ).
905-
906- Omit the port argument, or use a port value of ` 0 ` , to have the operating system
907- assign a random port, which can be retrieved by using ` server.address().port `
908- after the ` 'listening' ` event has been emitted.
909-
910- To listen to a unix socket, supply a filename instead of port and hostname.
911-
912- ` backlog ` is the maximum length of the queue of pending connections.
913- The actual length will be determined by the OS through sysctl settings such as
914- ` tcp_max_syn_backlog ` and ` somaxconn ` on linux. The default value of this
915- parameter is 511 (not 512).
916-
917- This function is asynchronous. ` callback ` will be added as a listener for the
918- [ ` 'listening' ` ] [ ] event. See also [ ` net.Server.listen(port) ` ] [ ] .
844+ ### server.listen()
919845
920- * Note* : The ` server.listen() ` method can be called again if and only if there was an error
921- during the first ` server.listen() ` call or ` server.close() ` has been called.
922- Otherwise, an ` ERR_SERVER_ALREADY_LISTEN ` error will be thrown.
846+ Starts the HTTP server listening for connections.
847+ This method is identical to [ ` server.listen() ` ] [ ] from [ ` net.Server ` ] [ ] .
923848
924849### server.listening
925850<!-- YAML
@@ -1978,6 +1903,7 @@ const req = http.request(options, (res) => {
19781903[ `response.write(data, encoding)` ] : #http_response_write_chunk_encoding_callback
19791904[ `response.writeContinue()` ] : #http_response_writecontinue
19801905[ `response.writeHead()` ] : #http_response_writehead_statuscode_statusmessage_headers
1906+ [ `server.listen()` ] : net.html#net_server_listen
19811907[ `server.timeout` ] : #http_server_timeout
19821908[ `setHeader(name, value)` ] : #http_request_setheader_name_value
19831909[ `socket.setKeepAlive()` ] : net.html#net_socket_setkeepalive_enable_initialdelay
0 commit comments