@ -6,7 +6,7 @@ The `net` module provides you with an asynchronous network wrapper. It contains
methods for creating both servers and clients (called streams). You can include
methods for creating both servers and clients (called streams). You can include
this module with `require('net');`
this module with `require('net');`
## net.createServer([options]\ [, connectionListener])
## net.createServer([options][, connectionListener])
Creates a new TCP server. The `connectionListener` argument is
Creates a new TCP server. The `connectionListener` argument is
automatically set as a listener for the ['connection'][] event.
automatically set as a listener for the ['connection'][] event.
@ -107,8 +107,8 @@ changed to
var client = net.connect({path: '/tmp/echo.sock'});
var client = net.connect({path: '/tmp/echo.sock'});
## net.connect(port[, host]\ [, connectListener])
## net.connect(port[, host][, connectListener])
## net.createConnection(port[, host]\ [, connectListener])
## net.createConnection(port[, host][, connectListener])
Creates a TCP connection to `port` on `host` . If `host` is omitted,
Creates a TCP connection to `port` on `host` . If `host` is omitted,
`'localhost'` will be assumed.
`'localhost'` will be assumed.
@ -130,7 +130,7 @@ A factory method which returns a new ['net.Socket'](#net_class_net_socket).
This class is used to create a TCP or local server.
This class is used to create a TCP or local server.
### server.listen(port[, host]\ [, backlog]\ [, callback])
### server.listen(port[, host][, backlog][, callback])
Begin accepting connections on the specified `port` and `host` . If the
Begin accepting connections on the specified `port` and `host` . If the
`host` is omitted, the server will accept connections directed to any
`host` is omitted, the server will accept connections directed to any
@ -352,7 +352,7 @@ Set `readable` and/or `writable` to `true` to allow reads and/or writes on this
socket (NOTE: Works only when `fd` is passed).
socket (NOTE: Works only when `fd` is passed).
About `allowHalfOpen` , refer to `createServer()` and `'end'` event.
About `allowHalfOpen` , refer to `createServer()` and `'end'` event.
### socket.connect(port[, host]\ [, connectListener])
### socket.connect(port[, host][, connectListener])
### socket.connect(path[, connectListener])
### socket.connect(path[, connectListener])
Opens the connection for a given socket. If `port` and `host` are given,
Opens the connection for a given socket. If `port` and `host` are given,
@ -395,7 +395,7 @@ Users who experience large or growing `bufferSize` should attempt to
Set the encoding for the socket as a Readable Stream. See
Set the encoding for the socket as a Readable Stream. See
[stream.setEncoding()][] for more information.
[stream.setEncoding()][] for more information.
### socket.write(data[, encoding]\ [, callback])
### socket.write(data[, encoding][, callback])
Sends data on the socket. The second parameter specifies the encoding in the
Sends data on the socket. The second parameter specifies the encoding in the
case of a string--it defaults to UTF8 encoding.
case of a string--it defaults to UTF8 encoding.
@ -407,7 +407,7 @@ buffer. Returns `false` if all or part of the data was queued in user memory.
The optional `callback` parameter will be executed when the data is finally
The optional `callback` parameter will be executed when the data is finally
written out - this may not be immediately.
written out - this may not be immediately.
### socket.end([data]\ [, encoding])
### socket.end([data][, encoding])
Half-closes the socket. i.e., it sends a FIN packet. It is possible the
Half-closes the socket. i.e., it sends a FIN packet. It is possible the
server will still send some data.
server will still send some data.
@ -450,7 +450,7 @@ algorithm, they buffer data before sending it off. Setting `true` for
`noDelay` will immediately fire off data each time `socket.write()` is called.
`noDelay` will immediately fire off data each time `socket.write()` is called.
`noDelay` defaults to `true` .
`noDelay` defaults to `true` .
### socket.setKeepAlive([enable]\ [, initialDelay])
### socket.setKeepAlive([enable][, initialDelay])
Enable/disable keep-alive functionality, and optionally set the initial
Enable/disable keep-alive functionality, and optionally set the initial
delay before the first keepalive probe is sent on an idle socket.
delay before the first keepalive probe is sent on an idle socket.