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)

'Declaration
<ObsoleteAttribute("BeginGetHostByName is obsoleted for this type, please use BeginGetHostEntry instead. http://go.microsoft.com/fwlink/?linkid=14202")> _
Public Shared Function BeginGetHostByName ( _
	hostName As String, _
	requestCallback As AsyncCallback, _
	stateObject As Object _
) As IAsyncResult
'Usage
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. http://go.microsoft.com/fwlink/?linkid=14202") */ 
public static IAsyncResult BeginGetHostByName (
	String hostName, 
	AsyncCallback requestCallback, 
	Object stateObject
)
ObsoleteAttribute("BeginGetHostByName is obsoleted for this type, please use BeginGetHostEntry instead. http://go.microsoft.com/fwlink/?linkid=14202") 
public static function BeginGetHostByName (
	hostName : String, 
	requestCallback : AsyncCallback, 
	stateObject : Object
) : IAsyncResult
Not applicable.

Parameters

hostName

The DNS name of the host.

requestCallback

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

stateObject

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

ArgumentNullException

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

SocketException

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.

NoteNote:

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

Windows 98, Windows Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

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

.NET Compact Framework

Supported in: 1.0
Obsolete (compiler warning) in 2.0

Reference

Dns Class
Dns Members
System.Net Namespace

Other Resources

Asynchronous Calls
Show: