Mono Class Library: System.Net.Dns Overview | Members

System.Net.Dns.BeginResolve Method

Begins the asynchronous execution of a DNS query to resolve a host name or IP address. [Edit]

[System.Obsolete("Use BeginGetHostEntry instead")]
public static IAsyncResult BeginResolve (string hostName, AsyncCallback requestCallback, object stateObject)

Parameters

hostName
A string containing the DNS name or IP address of the host. [Edit]
requestCallback
A AsyncCallback delegate or null . [Edit]
stateObject
An application-defined object, or null . [Edit]

Returns

A IAsyncResult instance that contains information about the asynchronous operation. [Edit]

Permissions

TypeReason
System.Net.DnsPermission [Edit] Requires unrestricted permission for accessing DNS information. See System.Net.DnsPermission and System.Security.Permissions.PermissionState.Unrestricted.

Exceptions

TypeReason
ArgumentNullExceptionhostName is null . [Edit]
System.Net.Sockets.SocketExceptionAn error was encountered executing the DNS query . [Edit]
System.Security.SecurityExceptionThe caller does not have permission to access DNS information. [Edit]

Remarks

This method starts an asynchronous request for DNS information about the specified host. To retrieve the results of the query and release resources allocated by this method, call the Dns.EndResolve(IAsyncResult) method, and specify the IAsyncResult object returned by this method.

Note: The Dns.EndResolve(IAsyncResult) method should be called exactly once for each call to Dns.BeginResolve(string, AsyncCallback, object)
.

If the requestCallback parameter is not null, the method referenced by requestCallback is invoked when the asynchronous operation completes. The IAsyncResult object returned by this method is passed as the argument to the method referenced by requestCallback. The method referenced by requestCallback can retrieve the results of the query by calling Dns.EndResolve(IAsyncResult).

The stateObject parameter can be any object that the caller wishes to have available for the duration of the asynchronous operation. This object is available via the IAsyncResult.AsyncState property of the object returned by this method.

[Edit]

Requirements

Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0