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