socket.connect(port[, host][, connectListener])
port
<number> 客户端要连接的端口。host
<string> 客户端要连接的主机。connectListener
<Function>socket.connect()
方法的通用参数。将会作为'connect'
事件的监听器被添加一次。- 返回: <net.Socket> 套接字自身。
在给定的套接字上启动 TCP 连接。
使用 {port: port, host: host}
作为 options
调用 socket.connect(options[, connectListener])
的别名。
port
<number> Port the client should connect to.host
<string> Host the client should connect to.connectListener
<Function> Common parameter ofsocket.connect()
methods. Will be added as a listener for the'connect'
event once.- Returns: <net.Socket> The socket itself.
Initiate a TCP connection on the given socket.
Alias to
socket.connect(options[, connectListener])
called with {port: port, host: host}
as options
.