# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Nested Classes | Constants | Methods | Inherited Methods

# DnsResolver

`public final class DnsResolver`
`extends Object` ``

java.lang.Object
↳ | android.net.DnsResolver

Dns resolver class for asynchronous dns querying Note that if a client sends a query with more than 1 record in the question section but the remote dns server does not support this, it may not respond at all, leading to a timeout.

## Summary

### Nested classes
`interface` | `DnsResolver.Callback<T>` Base interface for answer callbacks
`class` | `DnsResolver.DnsException` Class to represent DNS error

### Constants
`int` | `CLASS_IN`
`int` | `ERROR_PARSE` Indicates that there was an error parsing the response the query.
`int` | `ERROR_SYSTEM` Indicates that there was an error sending the query.
`int` | `FLAG_EMPTY`
`int` | `FLAG_NO_CACHE_LOOKUP`
`int` | `FLAG_NO_CACHE_STORE`
`int` | `FLAG_NO_RETRY`
`int` | `TYPE_A`
`int` | `TYPE_AAAA`

### Public methods
`static DnsResolver` | `getInstance()` Get instance for DnsResolver
`void` | `query(Network network, String domain, int flags, Executor executor, CancellationSignal cancellationSignal, Callback<? super List<InetAddress>> callback)` Send a DNS query with the specified name on a network with both IPv4 and IPv6, get back a set of InetAddresses with rfc6724 sorting style asynchronously.
`void` | `query(Network network, String domain, int nsType, int flags, Executor executor, CancellationSignal cancellationSignal, Callback<? super List<InetAddress>> callback)` Send a DNS query with the specified name and query type, get back a set of InetAddresses with rfc6724 sorting style asynchronously.
`void` | `rawQuery(Network network, byte[] query, int flags, Executor executor, CancellationSignal cancellationSignal, Callback<? super byte[]> callback)` Send a raw DNS query.
`void` | `rawQuery(Network network, String domain, int nsClass, int nsType, int flags, Executor executor, CancellationSignal cancellationSignal, Callback<? super byte[]> callback)` Send a DNS query with the specified name, class and query type.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Constants

### CLASS_IN

    public static final int CLASS_IN

Constant Value: 1 (0x00000001)

### ERROR_PARSE

    public static final int ERROR_PARSE

Indicates that there was an error parsing the response the query. The cause of this error is available via getCause() and is a `ParseException`.

Constant Value: 0 (0x00000000)

### ERROR_SYSTEM

    public static final int ERROR_SYSTEM

Indicates that there was an error sending the query. The cause of this error is available via getCause() and is an ErrnoException.

Constant Value: 1 (0x00000001)

### FLAG_EMPTY

    public static final int FLAG_EMPTY

Constant Value: 0 (0x00000000)

### FLAG_NO_CACHE_LOOKUP

    public static final int FLAG_NO_CACHE_LOOKUP

Constant Value: 4 (0x00000004)

### FLAG_NO_CACHE_STORE

    public static final int FLAG_NO_CACHE_STORE

Constant Value: 2 (0x00000002)

### FLAG_NO_RETRY

    public static final int FLAG_NO_RETRY

Constant Value: 1 (0x00000001)

### TYPE_A

    public static final int TYPE_A

Constant Value: 1 (0x00000001)

### TYPE_AAAA

    public static final int TYPE_AAAA

Constant Value: 28 (0x0000001c)

## Public methods

### getInstance

    public static DnsResolver getInstance ()

Get instance for DnsResolver

Returns
`DnsResolver` | This value cannot be `null`.

### query

    public void query (Network network,
                    String domain,
                    int flags,
                    Executor executor,
                    CancellationSignal cancellationSignal,
                    Callback<? super List<InetAddress>> callback)

Send a DNS query with the specified name on a network with both IPv4 and IPv6, get back a set of InetAddresses with rfc6724 sorting style asynchronously. This method will examine the connection ability on given network, and query IPv4 and IPv6 if connection is available. If at least one query succeeded with valid answer, rcode will be 0 The answer will be provided asynchronously through the provided `Callback`.

Parameters
`network` | `Network`: `Network` specifying which network to query on. `null` for query on default network. This value may be `null`.
`domain` | `String`: domain name to query This value cannot be `null`.
`flags` | `int`: flags as a combination of the FLAGS_* constants Value is `FLAG_EMPTY`, `FLAG_NO_RETRY`, `FLAG_NO_CACHE_STORE`, or `FLAG_NO_CACHE_LOOKUP`
`executor` | `Executor`: The `Executor` that the callback should be executed on. This value cannot be `null`. Callback and listener events are dispatched through this `Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `Context.getMainExecutor()`. To dispatch events through a shared thread pool, you can use `AsyncTask#THREAD_POOL_EXECUTOR`.
`cancellationSignal` | `CancellationSignal`: used by the caller to signal if the query should be cancelled. May be `null`. This value may be `null`.
`callback` | `Callback`: a `Callback` which will be called to notify the caller of the result of dns query. This value cannot be `null`.

### query

    public void query (Network network,
                    String domain,
                    int nsType,
                    int flags,
                    Executor executor,
                    CancellationSignal cancellationSignal,
                    Callback<? super List<InetAddress>> callback)

Send a DNS query with the specified name and query type, get back a set of InetAddresses with rfc6724 sorting style asynchronously. The answer will be provided asynchronously through the provided `Callback`.

Parameters
`network` | `Network`: `Network` specifying which network to query on. `null` for query on default network. This value may be `null`.
`domain` | `String`: domain name to query This value cannot be `null`.
`nsType` | `int`: dns resource record (RR) type as one of the TYPE_* constants Value is `TYPE_A`, or `TYPE_AAAA`
`flags` | `int`: flags as a combination of the FLAGS_* constants Value is `FLAG_EMPTY`, `FLAG_NO_RETRY`, `FLAG_NO_CACHE_STORE`, or `FLAG_NO_CACHE_LOOKUP`
`executor` | `Executor`: The `Executor` that the callback should be executed on. This value cannot be `null`. Callback and listener events are dispatched through this `Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `Context.getMainExecutor()`. To dispatch events through a shared thread pool, you can use `AsyncTask#THREAD_POOL_EXECUTOR`.
`cancellationSignal` | `CancellationSignal`: used by the caller to signal if the query should be cancelled. May be `null`. This value may be `null`.
`callback` | `Callback`: a `Callback` which will be called to notify the caller of the result of dns query. This value cannot be `null`.

### rawQuery

    public void rawQuery (Network network,
                    byte[] query,
                    int flags,
                    Executor executor,
                    CancellationSignal cancellationSignal,
                    Callback<? super byte[]> callback)

Send a raw DNS query. The answer will be provided asynchronously through the provided `Callback`.

Parameters
`network` | `Network`: `Network` specifying which network to query on. `null` for query on default network. This value may be `null`.
`query` | `byte`: blob message to query This value cannot be `null`.
`flags` | `int`: flags as a combination of the FLAGS_* constants Value is `FLAG_EMPTY`, `FLAG_NO_RETRY`, `FLAG_NO_CACHE_STORE`, or `FLAG_NO_CACHE_LOOKUP`
`executor` | `Executor`: The `Executor` that the callback should be executed on. This value cannot be `null`. Callback and listener events are dispatched through this `Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `Context.getMainExecutor()`. To dispatch events through a shared thread pool, you can use `AsyncTask#THREAD_POOL_EXECUTOR`.
`cancellationSignal` | `CancellationSignal`: used by the caller to signal if the query should be cancelled. May be `null`. This value may be `null`.
`callback` | `Callback`: a `Callback` which will be called to notify the caller of the result of dns query. This value cannot be `null`.

### rawQuery

    public void rawQuery (Network network,
                    String domain,
                    int nsClass,
                    int nsType,
                    int flags,
                    Executor executor,
                    CancellationSignal cancellationSignal,
                    Callback<? super byte[]> callback)

Send a DNS query with the specified name, class and query type. The answer will be provided asynchronously through the provided `Callback`.

Parameters
`network` | `Network`: `Network` specifying which network to query on. `null` for query on default network. This value may be `null`.
`domain` | `String`: domain name to query This value cannot be `null`.
`nsClass` | `int`: dns class as one of the CLASS_* constants Value is `CLASS_IN`
`nsType` | `int`: dns resource record (RR) type as one of the TYPE_* constants Value is `TYPE_A`, or `TYPE_AAAA`
`flags` | `int`: flags as a combination of the FLAGS_* constants Value is `FLAG_EMPTY`, `FLAG_NO_RETRY`, `FLAG_NO_CACHE_STORE`, or `FLAG_NO_CACHE_LOOKUP`
`executor` | `Executor`: The `Executor` that the callback should be executed on. This value cannot be `null`. Callback and listener events are dispatched through this `Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `Context.getMainExecutor()`. To dispatch events through a shared thread pool, you can use `AsyncTask#THREAD_POOL_EXECUTOR`.
`cancellationSignal` | `CancellationSignal`: used by the caller to signal if the query should be cancelled. May be `null`. This value may be `null`.
`callback` | `Callback`: a `Callback` which will be called to notify the caller of the result of dns query. This value cannot be `null`.

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*