Package javax.jmdns.impl
Class DNSOutgoing
java.lang.Object
javax.jmdns.impl.DNSMessage
javax.jmdns.impl.DNSOutgoing
An outgoing DNS message.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DNSOutgoing.MessageOutputStreamprivate final DNSOutgoing.MessageOutputStreamprivate final DNSOutgoing.MessageOutputStreamprivate InetSocketAddressprivate intprivate final DNSOutgoing.MessageOutputStreamprivate static final intstatic booleanThis can be used to turn off domain name compression.Fields inherited from class javax.jmdns.impl.DNSMessage
_additionals, _answers, _authoritativeAnswers, _multicast, _questions, MULTICAST, UNICAST -
Constructor Summary
ConstructorsConstructorDescriptionDNSOutgoing(int flags) Create an outgoing multicast query or response.DNSOutgoing(int flags, boolean multicast) Create an outgoing query or response.DNSOutgoing(int flags, boolean multicast, int senderUDPPayload) Create an outgoing query or response. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAdditionalAnswer(DNSIncoming in, DNSRecord rec) Add an additional answer to the record.voidaddAnswer(DNSIncoming in, DNSRecord rec) Add an answer if it is not suppressed.voidAdd an answer to the message.voidAdd an authoritative answer to the message.voidaddQuestion(DNSQuestion rec) Add a question to the message.intReturn the number of byte available in the message.byte[]data()Builds the final message buffer to be send and returns it.Get the forced destination address if a specific one was set.int(package private) Stringprint(boolean dump) Debugging.voidsetDestination(InetSocketAddress destination) Force a specific destination address if packet is sent.toString()Methods inherited from class javax.jmdns.impl.DNSMessage
getAdditionals, getAllAnswers, getAnswers, getAuthorities, getFlags, getId, getNumberOfAdditionals, getNumberOfAnswers, getNumberOfAuthorities, getNumberOfQuestions, getOperationCode, getQuestions, isAuthoritativeAnswer, isEmpty, isMulticast, isQuery, isResponse, isTruncated, isValidResponseCode, print, print, setFlags, setId
-
Field Details
-
USE_DOMAIN_NAME_COMPRESSION
public static boolean USE_DOMAIN_NAME_COMPRESSIONThis can be used to turn off domain name compression. This was helpful for tracking problems interacting with other mdns implementations. -
_names
-
_maxUDPPayload
private int _maxUDPPayload -
_questionsBytes
-
_answersBytes
-
_authoritativeAnswersBytes
-
_additionalsAnswersBytes
-
HEADER_SIZE
private static final int HEADER_SIZE- See Also:
-
_destination
-
-
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
Get the forced destination address if a specific one was set.- Returns:
- a forced destination address or null if no address is forced.
-
setDestination
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
Add a question to the message.- Parameters:
rec-- Throws:
IOException
-
addAnswer
Add an answer if it is not suppressed.- Parameters:
in-rec-- Throws:
IOException
-
addAnswer
Add an answer to the message.- Parameters:
rec-now-- Throws:
IOException
-
addAuthorativeAnswer
Add an authoritative answer to the message.- Parameters:
rec-- Throws:
IOException
-
addAdditionalAnswer
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
Debugging. -
toString
-
getMaxUDPPayload
public int getMaxUDPPayload()- Returns:
- the maxUDPPayload
-