Dns.BeginGetHostByName(String, AsyncCallback, Object) 方法

定义

注意

BeginGetHostByName is obsoleted for this type, please use BeginGetHostEntry instead. https://go.microsoft.com/fwlink/?linkid=14202

注意

BeginGetHostByName is obsoleted for this type, please use BeginGetHostEntry instead. http://go.microsoft.com/fwlink/?linkid=14202

注意

Use BeginGetHostEntry instead

开始异步请求关于指定 DNS 主机名的 IPHostEntry 信息。Begins an asynchronous request for IPHostEntry information about the specified DNS host name.

public:
 static IAsyncResult ^ BeginGetHostByName(System::String ^ hostName, AsyncCallback ^ requestCallback, System::Object ^ stateObject);
[System.Obsolete("BeginGetHostByName is obsoleted for this type, please use BeginGetHostEntry instead. https://go.microsoft.com/fwlink/?linkid=14202")]
public static IAsyncResult BeginGetHostByName (string hostName, AsyncCallback? requestCallback, object? stateObject);
[System.Obsolete("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);
[System.Obsolete("BeginGetHostByName is obsoleted for this type, please use BeginGetHostEntry instead. https://go.microsoft.com/fwlink/?linkid=14202")]
public static IAsyncResult BeginGetHostByName (string hostName, AsyncCallback requestCallback, object stateObject);
public static IAsyncResult BeginGetHostByName (string hostName, AsyncCallback requestCallback, object stateObject);
[System.Obsolete("Use BeginGetHostEntry instead")]
public static IAsyncResult BeginGetHostByName (string hostName, AsyncCallback requestCallback, object stateObject);
[<System.Obsolete("BeginGetHostByName is obsoleted for this type, please use BeginGetHostEntry instead. https://go.microsoft.com/fwlink/?linkid=14202")>]
static member BeginGetHostByName : string * AsyncCallback * obj -> IAsyncResult
static member BeginGetHostByName : string * AsyncCallback * obj -> IAsyncResult
[<System.Obsolete("BeginGetHostByName is obsoleted for this type, please use BeginGetHostEntry instead. http://go.microsoft.com/fwlink/?linkid=14202")>]
static member BeginGetHostByName : string * AsyncCallback * obj -> IAsyncResult
[<System.Obsolete("Use BeginGetHostEntry instead")>]
static member BeginGetHostByName : string * AsyncCallback * obj -> IAsyncResult
Public Shared Function BeginGetHostByName (hostName As String, requestCallback As AsyncCallback, stateObject As Object) As IAsyncResult

参数

hostName
String

主机的 DNS 名称。The DNS name of the host.

requestCallback
AsyncCallback

一个 AsyncCallback 委托,它引用操作完成时要调用的方法。An AsyncCallback delegate that references the method to invoke when the operation is complete.

stateObject
Object

一个用户定义对象,其中包含操作的相关信息。A user-defined object that contains information about the operation. 当操作完成时,此对象会被传递给 requestCallback 委托。This object is passed to the requestCallback delegate when the operation is complete.

返回

IAsyncResult

引用异步请求的 IAsyncResult 实例。An IAsyncResult instance that references the asynchronous request.

属性

例外

hostNamenullhostName is null.

执行 DNS 查询时遇到错误。An error was encountered executing the DNS query.

注解

BeginGetHostByName必须通过调用方法完成异步操作 EndGetHostByNameThe asynchronous BeginGetHostByName operation must be completed by calling the EndGetHostByName method. 通常,方法由 requestCallback 委托调用。Typically, the method is invoked by the requestCallback delegate.

在操作完成之前,此方法不会被阻止。This method does not block until the operation is complete. 若要在操作完成之前一直阻止,请使用 GetHostByName 方法。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. 有关详细信息,请参阅 .NET Framework 中的网络跟踪For more information, see Network Tracing in the .NET Framework.

适用于