Skip to content

Commit 5c7ab96

Browse files
zertoshrvagg
authored andcommitted
doc: fix net.Server.listen bind behavior
PR-URL: #503 Reviewed-By: Rod Vagg <[email protected]>
1 parent 84b05d4 commit 5c7ab96

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

doc/api/http.markdown

+4-3
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,10 @@ If a client connection emits an 'error' event, it will be forwarded here.
162162

163163
### server.listen(port[, hostname][, backlog][, callback])
164164

165-
Begin accepting connections on the specified port and hostname. If the
166-
hostname is omitted, the server will accept connections directed to any
167-
IPv4 address (`INADDR_ANY`).
165+
Begin accepting connections on the specified `port` and `hostname`. If the
166+
`hostname` is omitted, the server will accept connections on any IPv6 address
167+
(`::`) when IPv6 is available, or any IPv4 address (`0.0.0.0`) otherwise. A
168+
port value of zero will assign a random port.
168169

169170
To listen to a unix socket, supply a filename instead of port and hostname.
170171

doc/api/net.markdown

+5-4
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,12 @@ A factory method which returns a new ['net.Socket'](#net_class_net_socket).
137137

138138
This class is used to create a TCP or local server.
139139

140-
### server.listen(port[, host][, backlog][, callback])
140+
### server.listen(port[, hostname][, backlog][, callback])
141141

142-
Begin accepting connections on the specified `port` and `host`. If the
143-
`host` is omitted, the server will accept connections directed to any
144-
IPv4 address (`INADDR_ANY`). A port value of zero will assign a random port.
142+
Begin accepting connections on the specified `port` and `hostname`. If the
143+
`hostname` is omitted, the server will accept connections on any IPv6 address
144+
(`::`) when IPv6 is available, or any IPv4 address (`0.0.0.0`) otherwise. A
145+
port value of zero will assign a random port.
145146

146147
Backlog is the maximum length of the queue of pending connections.
147148
The actual length will be determined by your OS through sysctl settings such as

doc/api/tls.markdown

+5-4
Original file line numberDiff line numberDiff line change
@@ -586,11 +586,12 @@ NOTE: you may want to use some npm module like [asn1.js] to parse the
586586
certificates.
587587

588588

589-
### server.listen(port[, host][, callback])
589+
### server.listen(port[, hostname][, callback])
590590

591-
Begin accepting connections on the specified `port` and `host`. If the
592-
`host` is omitted, the server will accept connections directed to any
593-
IPv4 address (`INADDR_ANY`).
591+
Begin accepting connections on the specified `port` and `hostname`. If the
592+
`hostname` is omitted, the server will accept connections on any IPv6 address
593+
(`::`) when IPv6 is available, or any IPv4 address (`0.0.0.0`) otherwise. A
594+
port value of zero will assign a random port.
594595

595596
This function is asynchronous. The last parameter `callback` will be called
596597
when the server has been bound.

0 commit comments

Comments
 (0)