connect(to:)
Connect the DatagramChannel
to address
.
func connect(to address: SocketAddress) -> EventLoopFuture<Channel>
Parameters
- address
The
SocketAddress
to connect to.
Connect the DatagramChannel
to address
.
func connect(to address: SocketAddress) -> EventLoopFuture<Channel>
s8NIOPosix17DatagramBootstrapC7connect2to7NIOCore15EventLoopFutureCyAF7Channel_pGAF13SocketAddressO_tF
What are these?9JSHW
The SocketAddress
to connect to.
import NIOPosix
final class DatagramBootstrap
A DatagramBootstrap
is an easy way to bootstrap a DatagramChannel
when creating datagram clients and servers.
enum SocketAddress
Represent a socket address to which we may want to connect or bind.
final class EventLoopFuture<Value>
Holder for a result that will be provided later.
protocol Channel : AnyObject, ChannelOutboundInvoker, _NIOPreconcurrencySendable
A Channel
is easiest thought of as a network socket. But it can be anything that is capable of I/O operations such as read, write, connect, and bind.
convenience init(group: EventLoopGroup)
Create a DatagramBootstrap
on the EventLoopGroup
group
.
init?(validatingGroup group: EventLoopGroup)
Create a DatagramBootstrap
on the EventLoopGroup
group
, validating that group
is compatible.
func bind(host: String, port: Int) -> EventLoopFuture<Channel>
Bind the DatagramChannel
to host
and port
.
func bind<Output>(host: String, port: Int, channelInitializer: @escaping (Channel) -> EventLoopFuture<Output>) async throws -> Output where Output : Sendable
Bind the DatagramChannel
to host
and port
.
func bind(to address: SocketAddress) -> EventLoopFuture<Channel>
Bind the DatagramChannel
to address
.
func bind<Output>(to address: SocketAddress, channelInitializer: @escaping (Channel) -> EventLoopFuture<Output>) async throws -> Output where Output : Sendable
Bind the DatagramChannel
to the address
.
func bind(unixDomainSocketPath: String) -> EventLoopFuture<Channel>
Bind the DatagramChannel
to a UNIX Domain Socket.
func bind(unixDomainSocketPath: String, cleanupExistingSocketFile: Bool) -> EventLoopFuture<Channel>
Bind the DatagramChannel
to a UNIX Domain Socket.
func bind<Output>(unixDomainSocketPath: String, cleanupExistingSocketFile: Bool = false, channelInitializer: @escaping (Channel) -> EventLoopFuture<Output>) async throws -> Output where Output : Sendable
Bind the DatagramChannel
to the unixDomainSocketPath
.
@preconcurrency func channelInitializer(_ handler: @escaping (Channel) -> EventLoopFuture<Void>) -> Self
Initialize the bound DatagramChannel
with initializer
. The most common task in initializer is to add ChannelHandler
s to the ChannelPipeline
.
func channelOption<Option>(_ option: Option, value: Option.Value) -> Self where Option : ChannelOption
Specifies a ChannelOption
to be applied to the DatagramChannel
.
func connect(host: String, port: Int) -> EventLoopFuture<Channel>
Connect the DatagramChannel
to host
and port
.
func connect<Output>(host: String, port: Int, channelInitializer: @escaping (Channel) -> EventLoopFuture<Output>) async throws -> Output where Output : Sendable
Connect the DatagramChannel
to host
and port
.
func connect<Output>(to address: SocketAddress, channelInitializer: @escaping (Channel) -> EventLoopFuture<Output>) async throws -> Output where Output : Sendable
Connect the DatagramChannel
to the address
.
func connect(unixDomainSocketPath: String) -> EventLoopFuture<Channel>
Connect the DatagramChannel
to a UNIX Domain Socket.
func connect<Output>(unixDomainSocketPath: String, channelInitializer: @escaping (Channel) -> EventLoopFuture<Output>) async throws -> Output where Output : Sendable
Connect the DatagramChannel
to the unixDomainSocketPath
.
func protocolSubtype(_ subtype: NIOBSDSocket.ProtocolSubtype) -> Self
func withBoundSocket(_ socket: NIOBSDSocket.Handle) -> EventLoopFuture<Channel>
Use the existing bound socket file descriptor.
func withBoundSocket<Output>(_ socket: NIOBSDSocket.Handle, channelInitializer: @escaping (Channel) -> EventLoopFuture<Output>) async throws -> Output where Output : Sendable
Use the existing bound socket file descriptor.
func withBoundSocket(descriptor: CInt) -> EventLoopFuture<Channel>
Use the existing bound socket file descriptor.