Package org.drasyl.handler.remote
Class UdpServer
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.ChannelDuplexHandler
org.drasyl.handler.remote.UdpServer
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelInboundHandler
,io.netty.channel.ChannelOutboundHandler
Binds to an udp port, sends outgoing messages via udp, and sends received udp packets to the
Channel
.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Signals that theUdpServer
was unable to bind to given address.static class
Signals that theUdpServer
is bound toUdpServer.UdpServerBound.getBindAddress()
.Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable
-
Constructor Summary
ConstructorDescriptionUdpServer
(Function<DrasylServerChannel, io.netty.channel.ChannelInitializer<io.netty.channel.socket.DatagramChannel>> channelInitializerSupplier) -
Method Summary
Modifier and TypeMethodDescriptionvoid
channelActive
(io.netty.channel.ChannelHandlerContext ctx) void
flush
(io.netty.channel.ChannelHandlerContext ctx) io.netty.channel.socket.DatagramChannel
void
write
(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise) Methods inherited from class io.netty.channel.ChannelDuplexHandler
bind, close, connect, deregister, disconnect, read
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelInactive, channelRead, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
Constructor Details
-
UdpServer
public UdpServer(Function<DrasylServerChannel, io.netty.channel.ChannelInitializer<io.netty.channel.socket.DatagramChannel>> channelInitializerSupplier) -
UdpServer
public UdpServer()
-
-
Method Details
-
channelActive
public void channelActive(io.netty.channel.ChannelHandlerContext ctx) throws UdpServer.UdpServerBindFailedException - Specified by:
channelActive
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelActive
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
UdpServer.UdpServerBindFailedException
-
write
public void write(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise) - Specified by:
write
in interfaceio.netty.channel.ChannelOutboundHandler
- Overrides:
write
in classio.netty.channel.ChannelDuplexHandler
-
flush
- Specified by:
flush
in interfaceio.netty.channel.ChannelOutboundHandler
- Overrides:
flush
in classio.netty.channel.ChannelDuplexHandler
- Throws:
Exception
-
udpChannel
public io.netty.channel.socket.DatagramChannel udpChannel()
-