Class NetherNetDiscovery

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<io.netty.channel.socket.DatagramPacket>
org.cloudburstmc.netty.channel.nethernet.signaling.NetherNetDiscovery
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler

public class NetherNetDiscovery extends io.netty.channel.SimpleChannelInboundHandler<io.netty.channel.socket.DatagramPacket>
  • Constructor Details

    • NetherNetDiscovery

      public NetherNetDiscovery(long networkId)
      Creates a NetherNetDiscovery instance with the specified Network ID.
      Parameters:
      networkId - The Network ID to use for discovery.
  • Method Details

    • bind

      public void bind()
    • bind

      public void bind(int port)
    • bind

      public void bind(InetSocketAddress address)
      Opens the discovery socket on a loop of its own, which close() shuts down.
    • sendDiscoveryRequest

      public void sendDiscoveryRequest(InetSocketAddress target, BiConsumer<Long,io.netty.buffer.ByteBuf> onServerFound)
    • setPongData

      public void setPongData(PongData data)
    • registerSignalHandler

      public void registerSignalHandler(String connectionId, NetherNetSignaling.SignalHandler handler)
    • unregisterSignalHandler

      public void unregisterSignalHandler(String connectionId)
    • setNewConnectionHandler

      public void setNewConnectionHandler(NetherNetServerSignaling.NewConnectionHandler handler)
    • sendSignalRetrying

      public io.netty.util.concurrent.ScheduledFuture<?> sendSignalRetrying(InetSocketAddress recipient, long targetNetworkId, String data, long delayMs)
      Sends a signal immediately and schedules it to be resent periodically until the returned ScheduledFuture is cancelled.
    • sendSignal

      public void sendSignal(InetSocketAddress recipient, long targetNetworkId, String data)
    • sendSignal

      public void sendSignal(long targetNetworkId, String data)
    • channelRead0

      protected void channelRead0(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.socket.DatagramPacket packet) throws Exception
      Specified by:
      channelRead0 in class io.netty.channel.SimpleChannelInboundHandler<io.netty.channel.socket.DatagramPacket>
      Throws:
      Exception
    • close

      public void close()
    • isActive

      public boolean isActive()