Resolver (dnsjava documentation)
Date: 2013-04-10

org.xbill.DNS

## Interface Resolver

- All Known Implementing Classes:
    ExtendedResolver, SimpleResolver

      public interface Resolver

  Interface describing a resolver.
  Author:
    Brian Wellington

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Message` | `send(Message query)` Sends a message and waits for a response.
    `Object` | `sendAsync(Message query, ResolverListener listener)` Asynchronously sends a message registering a listener to receive a callback on success or exception.
    `void` | `setEDNS(int level)` Sets the EDNS version used on outgoing messages.
    `void` | `setEDNS(int level, int payloadSize, int flags, List options)` Sets the EDNS information on outgoing messages.
    `void` | `setIgnoreTruncation(boolean flag)` Sets whether truncated responses will be ignored.
    `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

- - ### Method Detail

    - #### setPort

          void setPort(int port)

      Sets the port to communicate with on the server
      Parameters:
        `port` - The port to send messages to

    - #### setTCP

          void setTCP(boolean flag)

      Sets whether TCP connections will be sent by default
      Parameters:
        `flag` - Indicates whether TCP connections are made

    - #### setIgnoreTruncation

          void setIgnoreTruncation(boolean flag)

      Sets whether truncated responses will be ignored. If not, a truncated response over UDP will cause a retransmission over TCP.
      Parameters:
        `flag` - Indicates whether truncated responses should be ignored.

    - #### setEDNS

          void setEDNS(int level)

      Sets the EDNS version used on outgoing messages.
      Parameters:
        `level` - The EDNS level to use. 0 indicates EDNS0 and -1 indicates no EDNS.
      Throws:
        `IllegalArgumentException` - An invalid level was indicated.

    - #### setEDNS

          void setEDNS(int level,
                     int payloadSize,
                     int flags,
                     List options)

      Sets the EDNS information on outgoing messages.
      Parameters:
        `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.
      Throws:
        `IllegalArgumentException` - An invalid field was specified.
      See Also:
        `OPTRecord`

    - #### setTSIGKey

          void setTSIGKey(TSIG key)

      Specifies the TSIG key that messages will be signed with
      Parameters:
        `key` - The key

    - #### setTimeout

          void setTimeout(int secs,
                        int msecs)

      Sets the amount of time to wait for a response before giving up.
      Parameters:
        `secs` - The number of seconds to wait.
        `msecs` - The number of milliseconds to wait.

    - #### setTimeout

          void setTimeout(int secs)

      Sets the amount of time to wait for a response before giving up.
      Parameters:
        `secs` - The number of seconds to wait.

    - #### send

          Message send(Message query)
                       throws IOException

      Sends a message and waits for a response.
      Parameters:
        `query` - The query to send.
      Returns:
        The response
      Throws:
        `IOException` - An error occurred while sending or receiving.

    - #### sendAsync

          Object sendAsync(Message query,
                         ResolverListener listener)

      Asynchronously sends a message registering a listener to receive a callback on success or exception. Multiple asynchronous lookups can be performed in parallel. Since the callback may be invoked before the function returns, external synchronization is necessary.
      Parameters:
        `query` - The query to send
        `listener` - The object containing the callbacks.
      Returns:
        An identifier, which is also a parameter in the callback