This documentation is archived and is not being maintained.

Dns.BeginGetHostByName Method

Begins an asynchronous request for IPHostEntry information about the specified DNS host name.

[Visual Basic]
Public Shared Function BeginGetHostByName( _
   ByVal hostName As String, _
   ByVal requestCallback As AsyncCallback, _
   ByVal stateObject As Object _
) As IAsyncResult
public static IAsyncResult BeginGetHostByName(
 string hostName,
 AsyncCallback requestCallback,
 object stateObject
public: static IAsyncResult* BeginGetHostByName(
 String* hostName,
 AsyncCallback* requestCallback,
 Object* stateObject
public static function BeginGetHostByName(
   hostName : String,
 requestCallback : AsyncCallback,
 stateObject : Object
) : IAsyncResult;


A string containing the DNS name of the host.
The AsyncCallback.
The State object.

Return Value

An IAsyncResult instance that references the asynchronous request.


Exception Type Condition
ArgumentNullException hostName is a null reference (Nothing in Visual Basic).
SecurityException The caller does not have permission to access DNS information.
SocketException An error was encountered executing the DNS query.


The BeginGetHostByName method starts an asynchronous request for DNS host information. The asynchronous callback method uses the EndGetHostByName method to return the actual host information.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

.NET Framework Security: 

See Also

Dns Class | Dns Members | System.Net Namespace | Including Asynchronous Calls