From 135cdda65666f91d661565c24768aec6dbb5f73a Mon Sep 17 00:00:00 2001 From: Andres Suarez Date: Sun, 18 Jan 2015 21:24:11 -0500 Subject: [PATCH 1/2] doc: fix net.Server.listen bind behavior --- doc/api/http.markdown | 7 ++++--- doc/api/net.markdown | 9 +++++---- doc/api/tls.markdown | 9 +++++---- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/doc/api/http.markdown b/doc/api/http.markdown index df76a25d66ad23..a788f224d857bb 100644 --- a/doc/api/http.markdown +++ b/doc/api/http.markdown @@ -162,9 +162,10 @@ If a client connection emits an 'error' event, it will be forwarded here. ### server.listen(port[, hostname][, backlog][, callback]) -Begin accepting connections on the specified port and hostname. If the -hostname is omitted, the server will accept connections directed to any -IPv4 address (`INADDR_ANY`). +Begin accepting connections on the specified `port` and `hostname`. If the +`hostname` is omitted, the server will accept connections on `::` when IPv6 +is available, or on `0.0.0.0` otherwise. A port value of zero will assign a +random port. To listen to a unix socket, supply a filename instead of port and hostname. diff --git a/doc/api/net.markdown b/doc/api/net.markdown index f1fdf99d0e7b46..c6fa504737d1bf 100644 --- a/doc/api/net.markdown +++ b/doc/api/net.markdown @@ -137,11 +137,12 @@ A factory method which returns a new ['net.Socket'](#net_class_net_socket). This class is used to create a TCP or local server. -### server.listen(port[, host][, backlog][, callback]) +### server.listen(port[, hostname][, backlog][, callback]) -Begin accepting connections on the specified `port` and `host`. If the -`host` is omitted, the server will accept connections directed to any -IPv4 address (`INADDR_ANY`). A port value of zero will assign a random port. +Begin accepting connections on the specified `port` and `hostname`. If the +`hostname` is omitted, the server will accept connections on `::` when IPv6 +is available, or on `0.0.0.0` otherwise. A port value of zero will assign a +random port. Backlog is the maximum length of the queue of pending connections. The actual length will be determined by your OS through sysctl settings such as diff --git a/doc/api/tls.markdown b/doc/api/tls.markdown index 11cea446666671..b408b827ccd6d1 100644 --- a/doc/api/tls.markdown +++ b/doc/api/tls.markdown @@ -586,11 +586,12 @@ NOTE: you may want to use some npm module like [asn1.js] to parse the certificates. -### server.listen(port[, host][, callback]) +### server.listen(port[, hostname][, callback]) -Begin accepting connections on the specified `port` and `host`. If the -`host` is omitted, the server will accept connections directed to any -IPv4 address (`INADDR_ANY`). +Begin accepting connections on the specified `port` and `hostname`. If the +`hostname` is omitted, the server will accept connections on `::` when IPv6 +is available, or on `0.0.0.0` otherwise. A port value of zero will assign a +random port. This function is asynchronous. The last parameter `callback` will be called when the server has been bound. From 0c0f40537fe76158b8d43c4d8c83e1173c84715b Mon Sep 17 00:00:00 2001 From: Andres Suarez Date: Thu, 22 Jan 2015 23:37:37 -0500 Subject: [PATCH 2/2] doc: clarify net.Server.listen bind behavior --- doc/api/http.markdown | 6 +++--- doc/api/net.markdown | 6 +++--- doc/api/tls.markdown | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/api/http.markdown b/doc/api/http.markdown index a788f224d857bb..ec1fdfe4960035 100644 --- a/doc/api/http.markdown +++ b/doc/api/http.markdown @@ -163,9 +163,9 @@ If a client connection emits an 'error' event, it will be forwarded here. ### server.listen(port[, hostname][, backlog][, callback]) Begin accepting connections on the specified `port` and `hostname`. If the -`hostname` is omitted, the server will accept connections on `::` when IPv6 -is available, or on `0.0.0.0` otherwise. A port value of zero will assign a -random port. +`hostname` is omitted, the server will accept connections on any IPv6 address +(`::`) when IPv6 is available, or any IPv4 address (`0.0.0.0`) otherwise. A +port value of zero will assign a random port. To listen to a unix socket, supply a filename instead of port and hostname. diff --git a/doc/api/net.markdown b/doc/api/net.markdown index c6fa504737d1bf..ff204a2ad6fad6 100644 --- a/doc/api/net.markdown +++ b/doc/api/net.markdown @@ -140,9 +140,9 @@ This class is used to create a TCP or local server. ### server.listen(port[, hostname][, backlog][, callback]) Begin accepting connections on the specified `port` and `hostname`. If the -`hostname` is omitted, the server will accept connections on `::` when IPv6 -is available, or on `0.0.0.0` otherwise. A port value of zero will assign a -random port. +`hostname` is omitted, the server will accept connections on any IPv6 address +(`::`) when IPv6 is available, or any IPv4 address (`0.0.0.0`) otherwise. A +port value of zero will assign a random port. Backlog is the maximum length of the queue of pending connections. The actual length will be determined by your OS through sysctl settings such as diff --git a/doc/api/tls.markdown b/doc/api/tls.markdown index b408b827ccd6d1..1587622a3dfbd6 100644 --- a/doc/api/tls.markdown +++ b/doc/api/tls.markdown @@ -589,9 +589,9 @@ certificates. ### server.listen(port[, hostname][, callback]) Begin accepting connections on the specified `port` and `hostname`. If the -`hostname` is omitted, the server will accept connections on `::` when IPv6 -is available, or on `0.0.0.0` otherwise. A port value of zero will assign a -random port. +`hostname` is omitted, the server will accept connections on any IPv6 address +(`::`) when IPv6 is available, or any IPv4 address (`0.0.0.0`) otherwise. A +port value of zero will assign a random port. This function is asynchronous. The last parameter `callback` will be called when the server has been bound.