Instance Methodswift-nio 2.72.0NIOPosix
bind(to:serverBackPressureStrategy:childChannelInitializer:)
Bind the ServerSocketChannel
to the address
parameter.
- iOS
- 13+
- macOS
- 10.15+
- tvOS
- 13+
- watchOS
- 6+
func bind<Output>(to address: SocketAddress, serverBackPressureStrategy: NIOAsyncSequenceProducerBackPressureStrategies.HighLowWatermark? = nil, childChannelInitializer: @escaping (Channel) -> EventLoopFuture<Output>) async throws -> NIOAsyncChannel<Output, Never> where Output : Sendable
Parameters
- address
The
SocketAddress
to bind on.- serverBackPressureStrategy
The back pressure strategy used by the server socket channel.
- channelInitializer
A closure to initialize the channel. The return value of this closure is returned from the
connect
method.
Returns
The result of the channel initializer.
Other members in extension
Type members
init(group: EventLoopGroup
) Create a
ServerBootstrap
on theEventLoopGroup
group
.init(group: EventLoopGroup, childGroup: EventLoopGroup
) Create a
ServerBootstrap
on theEventLoopGroup
group
which acceptsChannel
s onchildGroup
.init?(validatingGroup: EventLoopGroup, childGroup: EventLoopGroup?
) Create a
ServerBootstrap
on theEventLoopGroup
group
which acceptsChannel
s onchildGroup
, validating that theEventLoopGroup
s are compatible withServerBootstrap
.
Instance members
func bind<Output>(NIOBSDSocket.Handle, cleanupExistingSocketFile: Bool, serverBackPressureStrategy: NIOAsyncSequenceProducerBackPressureStrategies.HighLowWatermark?, childChannelInitializer: @escaping (Channel) -> EventLoopFuture<Output>
) async throws -> NIOAsyncChannel<Output, Never> Use the existing bound socket file descriptor.
func bind(host: String, port: Int
) -> EventLoopFuture<Channel> Bind the
ServerSocketChannel
tohost
andport
.func bind<Output>(host: String, port: Int, serverBackPressureStrategy: NIOAsyncSequenceProducerBackPressureStrategies.HighLowWatermark?, childChannelInitializer: @escaping (Channel) -> EventLoopFuture<Output>
) async throws -> NIOAsyncChannel<Output, Never> Bind the
ServerSocketChannel
to thehost
andport
parameters.func bind(to: VsockAddress
) -> EventLoopFuture<Channel> Bind the
ServerSocketChannel
to a VSOCK socket.func bind(to: SocketAddress
) -> EventLoopFuture<Channel> Bind the
ServerSocketChannel
toaddress
.func bind<Output>(to: VsockAddress, serverBackPressureStrategy: NIOAsyncSequenceProducerBackPressureStrategies.HighLowWatermark?, childChannelInitializer: @escaping (Channel) -> EventLoopFuture<Output>
) async throws -> NIOAsyncChannel<Output, Never> Bind the
ServerSocketChannel
to a VSOCK socket.func bind(unixDomainSocketPath: String
) -> EventLoopFuture<Channel> Bind the
ServerSocketChannel
to a UNIX Domain Socket.func bind(unixDomainSocketPath: String, cleanupExistingSocketFile: Bool
) -> EventLoopFuture<Channel> Bind the
ServerSocketChannel
to a UNIX Domain Socket.func bind<Output>(unixDomainSocketPath: String, cleanupExistingSocketFile: Bool, serverBackPressureStrategy: NIOAsyncSequenceProducerBackPressureStrategies.HighLowWatermark?, childChannelInitializer: @escaping (Channel) -> EventLoopFuture<Output>
) async throws -> NIOAsyncChannel<Output, Never> Bind the
ServerSocketChannel
to a UNIX Domain Socket.func bindTimeout(TimeAmount
) -> Self Specifies a timeout to apply to a bind attempt. Currently unsupported.
func childChannelInitializer(@escaping (Channel) -> EventLoopFuture<Void>
) -> Self Initialize the accepted
SocketChannel
s withinitializer
. The most common task in initializer is to addChannelHandler
s to theChannelPipeline
. Note that if theinitializer
fails then the error will be fired in the parent channel.func childChannelOption<Option>(Option, value: Option.Value
) -> Self Specifies a
ChannelOption
to be applied to the acceptedSocketChannel
s.func enableMPTCP(Bool
) -> Self Enables multi-path TCP support.
func serverChannelInitializer(@escaping (Channel) -> EventLoopFuture<Void>
) -> Self Initialize the
ServerSocketChannel
withinitializer
. The most common task in initializer is to addChannelHandler
s to theChannelPipeline
.func serverChannelOption<Option>(Option, value: Option.Value
) -> Self Specifies a
ChannelOption
to be applied to theServerSocketChannel
.func withBoundSocket(NIOBSDSocket.Handle
) -> EventLoopFuture<Channel> Use the existing bound socket file descriptor.
Show obsolete interfaces (1)
Hide obsolete interfaces
func withBoundSocket(descriptor: CInt
) -> EventLoopFuture<Channel> Use the existing bound socket file descriptor.