Bun.TCPSocketConnectOptions TypeScript interface | API Reference | Bun
BuildDocsReferenceGuidesBlogDiscord/
Bun/
TCPSocketConnectOptionsPallowHalfOpenPdataPexclusivePhostnamePipv6OnlyPportPreusePortPsocketPtlsSearch the reference...
/
BuildDocsReferenceGuidesBlogDiscord/
Bun/
TCPSocketConnectOptionsPallowHalfOpenPdataPexclusivePhostnamePipv6OnlyPportPreusePortPsocketPtlsinterface
TCPSocketConnectOptionsinterface
TCPSocketConnectOptionsData = undefined>
allowHalfOpen?: boolean
Whether to allow half-open connections.
A half-open connection occurs when one end of the connection has called close() or sent a FIN packet, while the other end remains open. When set to true:
The socket won't automatically send FIN when the remote side closes its endThe local side can continue sending data even after the remote side has closedThe application must explicitly call end() to fully close the connectionWhen false, the socket automatically closes both ends of the connection when either side closes.
data?: Data
The per-instance data context
exclusive?: boolean
Whether to use exclusive mode.
When set to true, the socket binds exclusively to the specified address:port combination, preventing other processes from binding to the same port.
When false (default), other sockets may be able to bind to the same port depending on the operating system's socket sharing capabilities and settings.
Exclusive mode is useful in scenarios where you want to ensure only one instance of your server can bind to a specific port at a time.
hostname: string
The hostname to connect to
ipv6Only?: boolean
port: number
The port to connect to
reusePort?: boolean
socket:
SocketHandlerData>
Handlers for socket events
tls?: boolean |
TLSOptionsTLS Configuration with which to create the socket
Resources
ReferenceDocsGuidesDiscordMerch StoreGitHubBlog Toolkit
RuntimePackage managerTest runnerBundlerPackage runnerProject
Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San Francisco
We're hiring →