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

定义

注意

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

注意

BeginGetHostByName has been deprecated. Use BeginGetHostEntry instead.

注意

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

开始异步请求关于指定 DNS 主机名的 IPHostEntry 信息。

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 has been deprecated. 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. 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("BeginGetHostByName is obsoleted for this type, please use BeginGetHostEntry instead. https://go.microsoft.com/fwlink/?linkid=14202")>]
static member BeginGetHostByName : string * AsyncCallback * obj -> IAsyncResult
[<System.Obsolete("BeginGetHostByName has been deprecated. Use BeginGetHostEntry instead.")>]
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
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 名称。

requestCallback
AsyncCallback

一个 AsyncCallback 委托,它引用操作完成时要调用的方法。

stateObject
Object

一个用户定义对象,其中包含操作的相关信息。 当操作完成时,此对象会被传递给 requestCallback 委托。

返回

引用异步请求的 IAsyncResult 实例。

属性

例外

hostNamenull

执行 DNS 查询时遇到错误。

注解

BeginGetHostByName异步操作必须通过调用 EndGetHostByName 方法完成。 通常,委托调用 requestCallback 方法。

在操作完成之前,此方法不会阻止。 若要阻止操作完成,请使用 GetHostByName 方法。

有关使用异步编程模型的详细信息,请参阅 异步调用同步方法

注意

在应用程序中启用网络跟踪时,此成员发出跟踪信息。 有关详细信息,请参阅 .NET Framework 中的网络跟踪

适用于

另请参阅