温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/reference/node/net/Socket/connect
点击访问原文链接

Socket.connect method | Node.js net module | Bun

Socket.connect method | Node.js net module | BunBuildDocsReferenceGuidesBlogDiscord/node:net/Socket/connectMconnect

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/node:net/Socket/connectMconnect

method

net.Socket.connectconnect(options: SocketConnectOpts,connectionListener?: () => void): this;Initiate a connection on a given socket.

Possible signatures:

socket.connect(options[, connectListener])socket.connect(path[, connectListener]) for IPC connections.socket.connect(port[, host][, connectListener]) for TCP connections.Returns: net.Socket The 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.

connect(port: number,host: string,connectionListener?: () => void): this;Initiate a connection on a given socket.

Possible signatures:

socket.connect(options[, connectListener])socket.connect(path[, connectListener]) for IPC connections.socket.connect(port[, host][, connectListener]) for TCP connections.Returns: net.Socket The 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.

connect(port: number,connectionListener?: () => void): this;Initiate a connection on a given socket.

Possible signatures:

socket.connect(options[, connectListener])socket.connect(path[, connectListener]) for IPC connections.socket.connect(port[, host][, connectListener]) for TCP connections.Returns: net.Socket The 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.

connect(path: string,connectionListener?: () => void): this;Initiate a connection on a given socket.

Possible signatures:

socket.connect(options[, connectListener])socket.connect(path[, connectListener]) for IPC connections.socket.connect(port[, host][, connectListener]) for TCP connections.Returns: net.Socket The 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.

Referenced typestype SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts

Resources

ReferenceDocsGuidesDiscordMerch StoreGitHubBlog 

Toolkit

RuntimePackage managerTest runnerBundlerPackage runner

Project

Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San Francisco

We're hiring →

智能索引记录