new net.Socket([options])
options
<Object> 可用的选项有:- 返回: <net.Socket>
创建新的套接字对象。
options
<Object> Available options are:fd
<number> If specified, wrap around an existing socket with the given file descriptor, otherwise a new socket will be created.allowHalfOpen
<boolean> If set tofalse
, then the socket will automatically end the writable side when the readable side ends. Seenet.createServer()
and the'end'
event for details. Default:false
.readable
<boolean> Allow reads on the socket when anfd
is passed, otherwise ignored. Default:false
.writable
<boolean> Allow writes on the socket when anfd
is passed, otherwise ignored. Default:false
.
- Returns: <net.Socket>
Creates a new socket object.
The newly created socket can be either a TCP socket or a streaming IPC
endpoint, depending on what it connect()
to.