public final class UdpServer extends java.lang.Object implements NettyConnector<UdpInbound,UdpOutbound>
| Modifier and Type | Class and Description |
|---|---|
static class |
UdpServer.Builder |
| Modifier and Type | Method and Description |
|---|---|
static UdpServer.Builder |
builder()
Creates a builder for
UdpServer |
static UdpServer |
create()
Bind a new UDP server to the "localhost" address and
port 12012. |
static UdpServer |
create(java.util.function.Consumer<? super ClientOptions.Builder<?>> options)
Bind a new UDP server to the bind address and port provided through the options.
|
static UdpServer |
create(int port)
Bind a new UDP server to the "localhost" address and specified port.
|
static UdpServer |
create(java.lang.String bindAddress)
Bind a new UDP server to the given bind address and
port 12012. |
static UdpServer |
create(java.lang.String bindAddress,
int port)
Bind a new UDP server to the given bind address and port.
|
protected ContextHandler<io.netty.channel.socket.DatagramChannel> |
doHandler(java.util.function.BiFunction<? super UdpInbound,? super UdpOutbound,? extends Publisher<java.lang.Void>> handler,
reactor.core.publisher.MonoSink<NettyContext> sink,
java.net.SocketAddress providedAddress)
Create a
ContextHandler for AbstractBootstrap.handler() |
reactor.core.publisher.Mono<? extends NettyContext> |
newHandler(java.util.function.BiFunction<? super UdpInbound,? super UdpOutbound,? extends Publisher<java.lang.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 UdpServer 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
UdpServerpublic static UdpServer create(java.lang.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 server on default portUdpServerpublic static UdpServer create(int port)
The type of emitted data or received data is ByteBuf
port - the port to listen on the localhost bind addressUdpServerpublic static UdpServer create(java.lang.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 server on the
passed portport - the port to listen on the passed bind addressUdpServerpublic static UdpServer create(java.util.function.Consumer<? super ClientOptions.Builder<?>> options)
The type of emitted data or received data is ByteBuf
options - the configuratorUdpServerpublic static UdpServer.Builder builder()
UdpServerpublic reactor.core.publisher.Mono<? extends NettyContext> newHandler(java.util.function.BiFunction<? super UdpInbound,? super UdpOutbound,? extends Publisher<java.lang.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<io.netty.channel.socket.DatagramChannel> doHandler(java.util.function.BiFunction<? super UdpInbound,? super UdpOutbound,? extends Publisher<java.lang.Void>> handler, reactor.core.publisher.MonoSink<NettyContext> sink, java.net.SocketAddress providedAddress)
ContextHandler for AbstractBootstrap.handler()handler - user provided in/out handlersink - user provided bind handlerContextHandler