Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_EDNS_PAYLOADSIZE
The default EDNS payload size
|
static int |
DEFAULT_PORT
The default port to send queries to
|
Constructor and Description |
---|
SimpleResolver()
Creates a SimpleResolver.
|
SimpleResolver(java.lang.String hostname)
Creates a SimpleResolver that will query the specified host
|
Modifier and Type | Method and Description |
---|---|
java.net.InetSocketAddress |
getAddress()
Gets the destination address associated with this SimpleResolver.
|
Message |
send(Message query)
Sends a message to a single server and waits for a response.
|
java.lang.Object |
sendAsync(Message query,
ResolverListener listener)
Asynchronously sends a message to a single server, registering a listener
to receive a callback on success or exception.
|
void |
setAddress(java.net.InetAddress addr)
Sets the address of the server to communicate with (on the default
DNS port)
|
void |
setAddress(java.net.InetSocketAddress addr)
Sets the address of the server to communicate with.
|
static void |
setDefaultResolver(java.lang.String hostname)
Sets the default host (initially localhost) to query
|
void |
setEDNS(int level)
Sets the EDNS version used on outgoing messages.
|
void |
setEDNS(int level,
int payloadSize,
int flags,
java.util.List options)
Sets the EDNS information on outgoing messages.
|
void |
setIgnoreTruncation(boolean flag)
Sets whether truncated responses will be ignored.
|
void |
setLocalAddress(java.net.InetAddress addr)
Sets the local address to bind to when sending messages.
|
void |
setLocalAddress(java.net.InetSocketAddress addr)
Sets the local address to bind to when sending messages.
|
void |
setPort(int port)
Sets the port to communicate with on the server
|
void |
setTCP(boolean flag)
Sets whether TCP connections will be sent by default
|
void |
setTimeout(int secs)
Sets the amount of time to wait for a response before giving up.
|
void |
setTimeout(int secs,
int msecs)
Sets the amount of time to wait for a response before giving up.
|
void |
setTSIGKey(TSIG key)
Specifies the TSIG key that messages will be signed with
|
public static final int DEFAULT_PORT
public static final int DEFAULT_EDNS_PAYLOADSIZE
public SimpleResolver(java.lang.String hostname) throws java.net.UnknownHostException
java.net.UnknownHostException
- Failure occurred while finding the hostpublic SimpleResolver() throws java.net.UnknownHostException
java.net.UnknownHostException
- Failure occurred while finding the hostResolverConfig
public java.net.InetSocketAddress getAddress()
public static void setDefaultResolver(java.lang.String hostname)
public void setPort(int port)
Resolver
public void setAddress(java.net.InetSocketAddress addr)
addr
- The address of the DNS serverpublic void setAddress(java.net.InetAddress addr)
addr
- The address of the DNS serverpublic void setLocalAddress(java.net.InetSocketAddress addr)
addr
- The local address to send messages from.public void setLocalAddress(java.net.InetAddress addr)
addr
- The local address to send messages from.public void setTCP(boolean flag)
Resolver
public void setIgnoreTruncation(boolean flag)
Resolver
setIgnoreTruncation
in interface Resolver
flag
- Indicates whether truncated responses should be ignored.public void setEDNS(int level, int payloadSize, int flags, java.util.List options)
Resolver
setEDNS
in interface Resolver
level
- The EDNS level to use. 0 indicates EDNS0 and -1 indicates no
EDNS.payloadSize
- The maximum DNS packet size that this host is capable
of receiving over UDP. If 0 is specified, the default (1280) is used.flags
- EDNS extended flags to be set in the OPT record.options
- EDNS options to be set in the OPT record, specified as a
List of OPTRecord.Option elements.OPTRecord
public void setEDNS(int level)
Resolver
public void setTSIGKey(TSIG key)
Resolver
setTSIGKey
in interface Resolver
key
- The keypublic void setTimeout(int secs, int msecs)
Resolver
setTimeout
in interface Resolver
secs
- The number of seconds to wait.msecs
- The number of milliseconds to wait.public void setTimeout(int secs)
Resolver
setTimeout
in interface Resolver
secs
- The number of seconds to wait.public Message send(Message query) throws java.io.IOException
public java.lang.Object sendAsync(Message query, ResolverListener listener)
Copyright © 2015. All Rights Reserved.