public final class UdpClient extends Object implements NettyConnector<UdpInbound,UdpOutbound>
| Modifier and Type | Class and Description |
|---|---|
static class |
UdpClient.Builder |
| Modifier and Type | Method and Description |
|---|---|
static UdpClient.Builder |
builder()
Creates a builder for
UdpClient |
static UdpClient |
create()
Bind a new UDP client to the "localhost" address and
port 12012. |
static UdpClient |
create(java.util.function.Consumer<? super ClientOptions.Builder<?>> 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)
Prepare a
BiFunction IO handler that will react on a new connected state
each
time
the returned Mono is subscribed. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitstart, start, startAndAwait, startAndAwaitpublic static UdpClient create()
port 12012.
The type of emitted data or received data is ByteBuf
UdpClientpublic static UdpClient create(String bindAddress)
port 12012.
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.Builder<?>> options)
The type of emitted data or received data is ByteBuf
options - the configuratorUdpClientpublic static UdpClient.Builder builder()
UdpClientpublic Mono<? extends NettyContext> newHandler(java.util.function.BiFunction<? super UdpInbound,? super UdpOutbound,? extends Publisher<Void>> handler)
NettyConnectorBiFunction IO handler that will react on a new connected state
each
time
the returned Mono is subscribed. This NettyConnector shouldn't assume
any state related to the individual created/cleaned resources.
The IO handler will return Publisher to signal when to terminate the
underlying resource channel.
newHandler in interface NettyConnector<UdpInbound,UdpOutbound>handler - the in/out callback returning a closing publisherMono completing with a Disposable token to dispose
the active handler (server, client connection...) or failing with the connection
error.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