Class UdpPacket

java.lang.Object
io.activej.net.socket.udp.UdpPacket

public final class UdpPacket extends Object
This class represents a UDP packet. Each message is routed from one machine to another based solely on information contained within that packet
  • Method Details

    • of

      public static UdpPacket of(ByteBuf buf, InetSocketAddress inetSocketAddress)
      Creates a new instance of UDP packet
      Parameters:
      buf - the data buffer to send or which was received
      inetSocketAddress - the address to which the packet should be sent or from which it was received
    • getBuf

      public ByteBuf getBuf()
      Returns the data buffer to send or which was received
    • getSocketAddress

      public InetSocketAddress getSocketAddress()
      Returns the address to which the packet should be sent or from which it was received.
    • recycle

      public void recycle()
      Recycles data buffer. You should do it after use.