diff options
author | Ryan <ry@tinyclouds.org> | 2009-07-31 11:59:36 +0200 |
---|---|---|
committer | Ryan <ry@tinyclouds.org> | 2009-07-31 11:59:36 +0200 |
commit | 5373c6869a8410e9a00771be09bc74cd17e9c843 (patch) | |
tree | b889c8f42b7496574317a4d8b0d5749ef2e788d2 /website | |
parent | 4db8bb93758097dd63b9661ffdef80f312a95f04 (diff) | |
download | nodejs-5373c6869a8410e9a00771be09bc74cd17e9c843.tar.gz nodejs-5373c6869a8410e9a00771be09bc74cd17e9c843.tar.bz2 nodejs-5373c6869a8410e9a00771be09bc74cd17e9c843.zip |
node.tcp.Server's backlog option is now an argument to listen()
Diffstat (limited to 'website')
-rw-r--r-- | website/api.txt | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/website/api.txt b/website/api.txt index a977c7298..fdd564929 100644 --- a/website/api.txt +++ b/website/api.txt @@ -892,7 +892,7 @@ function echo (socket) { socket.close(); }); } -var server = node.tcp.createServer(echo, {backlog: 1024}); +var server = node.tcp.createServer(echo); server.listen(7000, "localhost"); ---------------------------------------- @@ -908,24 +908,25 @@ server.listen(7000, "localhost"); error occured +errorno+ will be 0. |========================================================= -+node.tcp.createServer(connection_listener, options={});+ :: ++node.tcp.createServer(connection_listener);+ :: Creates a new TCP server. + The +connection_listener+ argument is automatically set as a listener for the +"connection"+ event. -+ -+options+ for now only supports one option: -+backlog+ which should be an integer and describes -how large of a connection backlog the operating system should -maintain for this server. The +backlog+ defaults -to 1024. - - -+server.listen(port, host=null)+ :: -Tells the server to listen for TCP connections to +port+ -and +host+. Note, +host+ is optional. If -+host+ is not specified the server will accept -connections to any IP address on the specified port. + + ++server.listen(port, host=null, backlog=1024)+ :: +Tells the server to listen for TCP connections to +port+ and +host+. + ++host+ is optional. If +host+ is not specified the server will accept client +connections on any network address. + +The third argument, +backlog+, is also optional and defaults to 1024. The ++backlog+ argument defines the maximum length to which the queue of pending +connections for the server may grow. If a connection request arrives when +the queue is full, the client may receive a "ECONNREFUSED" error or, if the +underlying protocol supports retransmission, the request may be ignored so +that a later reattempt at connection succeeds +server.close()+:: |