Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2010-11-16 07:26:46 +0300
committerRyan Dahl <ry@tinyclouds.org>2010-11-16 07:26:46 +0300
commite5cc6388cbdfca14eadf0d89a4247db37af3e085 (patch)
tree120a01068bbdf4006a8a54f093101340b8d8b099 /doc
parent90d1e47323096b01ae78218e2ea21e7d68690cf8 (diff)
Docs for server.address()
Diffstat (limited to 'doc')
-rw-r--r--doc/api/net.markdown19
1 files changed, 19 insertions, 0 deletions
diff --git a/doc/api/net.markdown b/doc/api/net.markdown
index 3e1ec08c16b..24d1e43edbd 100644
--- a/doc/api/net.markdown
+++ b/doc/api/net.markdown
@@ -86,6 +86,25 @@ Stops the server from accepting new connections. This function is
asynchronous, the server is finally closed when the server emits a `'close'`
event.
+
+#### server.address()
+
+Returns the bound address of the server as seen by the operating system.
+Useful to find which port was assigned when giving getting an OS-assigned address
+
+Example:
+
+ var server = net.createServer(function (socket) {
+ socket.end("goodbye\n");
+ });
+
+ // grab a random port.
+ server.listen(function() {
+ address = server.address();
+ console.log("opened server on %j", address);
+ });
+
+
#### server.maxConnections
Set this property to reject connections when the server's connection count gets high.