Partager via


DnsOptions Class

Definition

A class configuring the host resolution functionality.

[Android.Runtime.Register("android/net/http/DnsOptions", ApiSince=34, DoNotGenerateAcw=true)]
public sealed class DnsOptions : Java.Lang.Object
[<Android.Runtime.Register("android/net/http/DnsOptions", ApiSince=34, DoNotGenerateAcw=true)>]
type DnsOptions = class
    inherit Object
Inheritance
DnsOptions
Attributes

Remarks

A class configuring the host resolution functionality. Note that while we refer to DNS as the most common mechanism being used for brevity, settings apply to other means of resolving hostnames like hosts file resolution.

Hostnames can be resolved in two ways - either by using the system resolver (using getaddrinfo provided by system libraries), or by using a custom resolver which is tailored for the HTTP networking stack.

The built-in stack provides several advantages over using the global system resolver:

<ul> <li>It has been tailored to the needs of the HTTP networking stack, particularly speed and stability. <li>getaddrinfo is a blocking call which requires dedicating worker threads and makes cancellation impossible (we need to abandon the thread until the call completes) <li>The getaddrinfo interface gives no insight into the root cause of failures <li>struct addrinfo provides no TTL (Time To Live) of the returned addresses. This restricts flexibility of handling caching (e.g. allowing the use of stale DNS records) and requires us to either rely on OS DNS caches, or be extremely conservative with the TTL. </ul>

Most configuration in this class is only applicable if the built-in DNS resolver is used.

Java documentation for android.net.http.DnsOptions.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Fields

DnsOptionDisabled
Obsolete.

Option is disabled.

DnsOptionEnabled
Obsolete.

Option is enabled.

DnsOptionUnspecified
Obsolete.

Option is unspecified, platform default value will be used.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
PersistHostCache

See Builder#setPersistHostCache(int)

PersistHostCachePeriod

See Builder#setPersistHostCachePeriod

PreestablishConnectionsToStaleDnsResults

See Builder#setPreestablishConnectionsToStaleDnsResults(int)

StaleDns

See Builder#setStaleDns(int)

ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
UseHttpStackDnsResolver

See Builder#setUseHttpStackDnsResolver(int)

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetStaleDnsOptions()
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Gets the JNI name of the type of the instance self.

JavaAs<TResult>(IJavaPeerable)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

TryJavaCast<TResult>(IJavaPeerable, TResult)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

Applies to