|
@ -163,6 +163,21 @@ and passed to the user through the `'connection'` event of a server. |
|
|
|
|
|
|
|
|
`net.Socket` instances are EventEmitters with the following events: |
|
|
`net.Socket` instances are EventEmitters with the following events: |
|
|
|
|
|
|
|
|
|
|
|
#### new net.Socket([options]) |
|
|
|
|
|
|
|
|
|
|
|
Construct a new socket object. |
|
|
|
|
|
|
|
|
|
|
|
`options` is an object with the following defaults: |
|
|
|
|
|
|
|
|
|
|
|
{ fd: null |
|
|
|
|
|
type: null |
|
|
|
|
|
allowHalfOpen: false |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
`fd` allows you to specify the existing file descriptor of socket. `type` |
|
|
|
|
|
specified underlying protocol. It can be `'tcp4'`, `'tcp6'`, or `'unix'`. |
|
|
|
|
|
About `allowHalfOpen`, refer to `createServer()` and `'end'` event. |
|
|
|
|
|
|
|
|
#### socket.connect(port, [host], [callback]) |
|
|
#### socket.connect(port, [host], [callback]) |
|
|
#### socket.connect(path, [callback]) |
|
|
#### socket.connect(path, [callback]) |
|
|
|
|
|
|
|
|