Skip to content

Commit 12cf359

Browse files
jjqq2013italoacasas
authored andcommitted
doc: add comment for net.Server.listen IPv6 '::'
Fixes: #9390 PR-URL: #11134 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
1 parent d1549bf commit 12cf359

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

doc/api/http.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,14 @@ added: v0.1.90
745745
* `callback` {Function}
746746

747747
Begin accepting connections on the specified `port` and `hostname`. If the
748-
`hostname` is omitted, the server will accept connections on any IPv6 address
749-
(`::`) when IPv6 is available, or any IPv4 address (`0.0.0.0`) otherwise.
748+
`hostname` is omitted, the server will accept connections on the
749+
[unspecified IPv6 address][] (`::`) when IPv6 is available, or the
750+
[unspecified IPv4 address][] (`0.0.0.0`) otherwise.
751+
752+
*Note*: in most operating systems, listening to the
753+
[unspecified IPv6 address][] (`::`) may cause the `net.Server` to also listen on
754+
the [unspecified IPv4 address][] (`0.0.0.0`).
755+
750756
Omit the port argument, or use a port value of `0`, to have the operating system
751757
assign a random port, which can be retrieved by using `server.address().port`
752758
after the `'listening'` event has been emitted.
@@ -1659,3 +1665,5 @@ There are a few special headers that should be noted.
16591665
[Readable Stream]: stream.html#stream_class_stream_readable
16601666
[Writable Stream]: stream.html#stream_class_stream_writable
16611667
[socket.unref()]: net.html#net_socket_unref
1668+
[unspecified IPv6 address]: https://en.wikipedia.org/wiki/IPv6_address#Unspecified_address
1669+
[unspecified IPv4 address]: https://en.wikipedia.org/wiki/0.0.0.0

doc/api/net.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,14 @@ added: v0.1.90
224224
-->
225225

226226
Begin accepting connections on the specified `port` and `hostname`. If the
227-
`hostname` is omitted, the server will accept connections on any IPv6 address
228-
(`::`) when IPv6 is available, or any IPv4 address (`0.0.0.0`) otherwise.
227+
`hostname` is omitted, the server will accept connections on the
228+
[unspecified IPv6 address][] (`::`) when IPv6 is available, or the
229+
[unspecified IPv4 address][] (`0.0.0.0`) otherwise.
230+
231+
*Note*: in most operating systems, listening to the
232+
[unspecified IPv6 address][] (`::`) may cause the `net.Server` to also listen on
233+
the [unspecified IPv4 address][] (`0.0.0.0`).
234+
229235
Omit the port argument, or use a port value of `0`, to have the operating system
230236
assign a random port, which can be retrieved by using `server.address().port`
231237
after the `'listening'` event has been emitted.
@@ -941,3 +947,5 @@ Returns true if input is a version 6 IP address, otherwise returns false.
941947
[`socket.setTimeout()`]: #net_socket_settimeout_timeout_callback
942948
[`stream.setEncoding()`]: stream.html#stream_readable_setencoding_encoding
943949
[Readable Stream]: stream.html#stream_class_stream_readable
950+
[unspecified IPv6 address]: https://en.wikipedia.org/wiki/IPv6_address#Unspecified_address
951+
[unspecified IPv4 address]: https://en.wikipedia.org/wiki/0.0.0.0

0 commit comments

Comments
 (0)