public final class UdpClient extends Object implements NettyConnector<UdpInbound,UdpOutbound>
| Modifier and Type | Method and Description |
|---|---|
static UdpClient |
create()
Bind a new UDP client to the "localhost" address and
port 12012. |
static UdpClient |
create(java.util.function.Consumer<? super ClientOptions> options)
Bind a new UDP client to the bind address and port provided through the options.
|
static UdpClient |
create(int port)
Bind a new UDP client to the "localhost" address and specified port.
|
static UdpClient |
create(String bindAddress)
Bind a new UDP client to the given bind address and
port 12012. |
static UdpClient |
create(String bindAddress,
int port)
Bind a new UDP client to the given bind address and port.
|
protected ContextHandler<DatagramChannel> |
doHandler(java.util.function.BiFunction<? super UdpInbound,? super UdpOutbound,? extends Publisher<Void>> handler,
MonoSink<NettyContext> sink,
SocketAddress providedAddress)
Create a
ContextHandler for AbstractBootstrap.handler() |
Mono<? extends NettyContext> |
newHandler(java.util.function.BiFunction<? super UdpInbound,? super UdpOutbound,? extends Publisher<Void>> handler) |
public static UdpClient create()
port 12012.
Handlers will run on the same thread they have been receiving IO events.
The type of emitted data or received data is ByteBuf
UdpClientpublic static UdpClient create(String bindAddress)
port 12012.
Handlers will run on the same thread they have been receiving IO events.
The type of emitted data or received data is ByteBuf
bindAddress - bind address (e.g. "127.0.0.1") to create the client on default portUdpClientpublic static UdpClient create(int port)
The type of emitted data or received data is ByteBuf
port - the port to listen on the localhost bind addressUdpClientpublic static UdpClient create(String bindAddress, int port)
The type of emitted data or received data is ByteBuf
bindAddress - bind address (e.g. "127.0.0.1") to create the client on the
passed portport - the port to listen on the passed bind addressUdpClientpublic static UdpClient create(java.util.function.Consumer<? super ClientOptions> options)
The type of emitted data or received data is ByteBuf
options - the configuratorUdpClientpublic Mono<? extends NettyContext> newHandler(java.util.function.BiFunction<? super UdpInbound,? super UdpOutbound,? extends Publisher<Void>> handler)
newHandler in interface Connector<ByteBuf,ByteBuf,UdpInbound,UdpOutbound>protected ContextHandler<DatagramChannel> doHandler(java.util.function.BiFunction<? super UdpInbound,? super UdpOutbound,? extends Publisher<Void>> handler, MonoSink<NettyContext> sink, SocketAddress providedAddress)
ContextHandler for AbstractBootstrap.handler()handler - user provided in/out handlersink - user provided bind handlerContextHandler