net.createConnection()


工厂函数,其创建新的 net.Socket,并立即使用 socket.connect() 发起连接,然后返回启动连接的 net.Socket

建立连接后,将在返回的套接字上触发 'connect' 事件。 最后一个参数 connectListener(如果提供)将作为 'connect' 事件的监听器添加一次。

可能的语法有:

net.connect() 函数是此函数的别名。

A factory function, which creates a new net.Socket, immediately initiates connection with socket.connect(), then returns the net.Socket that starts the connection.

When the connection is established, a 'connect' event will be emitted on the returned socket. The last parameter connectListener, if supplied, will be added as a listener for the 'connect' event once.

Possible signatures:

The net.connect() function is an alias to this function.