method Socket.prototype.connect
Jump to headingSocket.prototype.connect(options: SocketConnectOpts,connectionListener?: () => void,): thisInitiate a connection on a given socket.
Possible signatures:
socket.connect(options[, connectListener])socket.connect(path[, connectListener])forIPCconnections.socket.connect(port[, host][, connectListener])for TCP connections.- Returns:
net.SocketThe socket itself.
This function is asynchronous. When the connection is established, the 'connect' event will be emitted. If there is a problem connecting,
instead of a 'connect' event, an 'error' event will be emitted with
the error passed to the 'error' listener.
The last parameter connectListener, if supplied, will be added as a listener
for the 'connect' event once.
This function should only be used for reconnecting a socket after'close' has been emitted or otherwise it may lead to undefined
behavior.
Parameters Jump to heading
Jump to headingoptions: SocketConnectOptsoptional
Jump to headingconnectionListener: () => voidReturn Type Jump to heading
thisJump to headingSocket.prototype.connect(port: number,host: string,connectionListener?: () => void,): thisParameters Jump to heading
Jump to headingport: numberJump to headinghost: stringoptional
Jump to headingconnectionListener: () => voidReturn Type Jump to heading
thisJump to headingSocket.prototype.connect(port: number,connectionListener?: () => void,): thisParameters Jump to heading
Jump to headingport: numberoptional
Jump to headingconnectionListener: () => voidReturn Type Jump to heading
thisJump to headingSocket.prototype.connect(path: string,connectionListener?: () => void,): thisParameters Jump to heading
Jump to headingpath: stringoptional
Jump to headingconnectionListener: () => voidReturn Type Jump to heading
this