net.createConnection()


创建新的 net.Socket 的工厂函数立即启动与 socket.connect() 的连接,然后返回启动连接的 net.Socket

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

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

¥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:

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

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