Class DNSOutgoing

java.lang.Object
javax.jmdns.impl.DNSMessage
javax.jmdns.impl.DNSOutgoing

public final class DNSOutgoing extends DNSMessage
An outgoing DNS message.
  • Field Details

  • Constructor Details

    • DNSOutgoing

      public DNSOutgoing(int flags)
      Create an outgoing multicast query or response.
      Parameters:
      flags -
    • DNSOutgoing

      public DNSOutgoing(int flags, boolean multicast)
      Create an outgoing query or response.
      Parameters:
      flags -
      multicast -
    • DNSOutgoing

      public DNSOutgoing(int flags, boolean multicast, int senderUDPPayload)
      Create an outgoing query or response.
      Parameters:
      flags -
      multicast -
      senderUDPPayload - The sender's UDP payload size is the number of bytes of the largest UDP payload that can be reassembled and delivered in the sender's network stack.
  • Method Details

    • getDestination

      public InetSocketAddress getDestination()
      Get the forced destination address if a specific one was set.
      Returns:
      a forced destination address or null if no address is forced.
    • setDestination

      public void setDestination(InetSocketAddress destination)
      Force a specific destination address if packet is sent.
      Parameters:
      destination - Set a destination address a packet should be sent to (instead the default one). You could use null to unset the forced destination.
    • availableSpace

      public int availableSpace()
      Return the number of byte available in the message.
      Returns:
      available space
    • addQuestion

      public void addQuestion(DNSQuestion rec) throws IOException
      Add a question to the message.
      Parameters:
      rec -
      Throws:
      IOException
    • addAnswer

      public void addAnswer(DNSIncoming in, DNSRecord rec) throws IOException
      Add an answer if it is not suppressed.
      Parameters:
      in -
      rec -
      Throws:
      IOException
    • addAnswer

      public void addAnswer(DNSRecord rec, long now) throws IOException
      Add an answer to the message.
      Parameters:
      rec -
      now -
      Throws:
      IOException
    • addAuthorativeAnswer

      public void addAuthorativeAnswer(DNSRecord rec) throws IOException
      Add an authoritative answer to the message.
      Parameters:
      rec -
      Throws:
      IOException
    • addAdditionalAnswer

      public void addAdditionalAnswer(DNSIncoming in, DNSRecord rec) throws IOException
      Add an additional answer to the record. Omit if there is no room.
      Parameters:
      in -
      rec -
      Throws:
      IOException
    • data

      public byte[] data()
      Builds the final message buffer to be send and returns it.
      Returns:
      bytes to send.
    • print

      String print(boolean dump)
      Debugging.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getMaxUDPPayload

      public int getMaxUDPPayload()
      Returns:
      the maxUDPPayload