This documentation is archived and is not being maintained.

Dns.BeginGetHostByName Method

NOTE: This method is now obsolete.

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

Namespace: System.Net
Assembly: System (in system.dll)

<ObsoleteAttribute("BeginGetHostByName is obsoleted for this type, please use BeginGetHostEntry instead.")> _
Public Shared Function BeginGetHostByName ( _
	hostName As String, _
	requestCallback As AsyncCallback, _
	stateObject As Object _
) As IAsyncResult
Dim hostName As String
Dim requestCallback As AsyncCallback
Dim stateObject As Object
Dim returnValue As IAsyncResult

returnValue = Dns.BeginGetHostByName(hostName, requestCallback, stateObject)
/** @attribute ObsoleteAttribute("BeginGetHostByName is obsoleted for this type, please use BeginGetHostEntry instead.") */ 
public static IAsyncResult BeginGetHostByName (
	String hostName, 
	AsyncCallback requestCallback, 
	Object stateObject
ObsoleteAttribute("BeginGetHostByName is obsoleted for this type, please use BeginGetHostEntry instead.") 
public static function BeginGetHostByName (
	hostName : String, 
	requestCallback : AsyncCallback, 
	stateObject : Object
) : IAsyncResult



The DNS name of the host.


An AsyncCallback delegate that references the method to invoke when the operation is complete.


A user-defined object that contains information about the operation. This object is passed to the requestCallback delegate when the operation is complete.

Return Value

An IAsyncResult instance that references the asynchronous request.

Exception typeCondition


hostName is a null reference (Nothing in Visual Basic).


An error was encountered executing the DNS query.

The asynchronous BeginGetHostByName operation must be completed by calling the EndGetHostByName method. Typically, the method is invoked by the requestCallback delegate.

This method does not block until the operation is complete. To block until the operation is complete, use the GetHostByName method.

For detailed information about using the asynchronous programming model, see Calling Synchronous Methods Asynchronously.


This member emits trace information when you enable network tracing in your application. For more information, see Network Tracing.

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 1.0, 1.1
Obsolete (compiler warning) in 2.0

.NET Compact Framework

Supported in: 1.0
Obsolete (compiler warning) in 2.0


Dns Class
Dns Members
System.Net Namespace

Other Resources

Asynchronous Calls