DatagramBootstrap

public final class DatagramBootstrap

A DatagramBootstrap is an easy way to bootstrap a DatagramChannel when creating datagram clients and servers.

Example:

    let group = MultiThreadedEventLoopGroup(numberOfThreads: 1)
    let bootstrap = DatagramBootstrap(group: group)
        // Enable SO_REUSEADDR.
        .channelOption(ChannelOptions.socket(SocketOptionLevel(SOL_SOCKET), SO_REUSEADDR), value: 1)
        .channelInitializer { channel in
            channel.pipeline.add(handler: MyChannelHandler())
        }
    defer {
        try! group.syncShutdownGracefully()
    }
    let channel = try! bootstrap.bind(host: "127.0.0.1", port: 53).wait()
    /* the Channel is now ready to send/receive datagrams */

    try channel.closeFuture.wait()  // Wait until the channel un-binds.

The DatagramChannel will operate on AddressedEnvelope<ByteBuffer> as inbound and outbound messages.