new net.Socket([options])
options
<Object> 可用选项有:- 返回: <net.Socket>
创建一个 socket 对象。
新创建的 socket 可以是 TCP socket 也可以是 IPC 端点流,取决于它连接 connect()
到什么。
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> Indicates whether half-opened TCP connections are allowed. 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.