共用方式為


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 資訊之非同步 (Asynchronous) 要求。

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 中的網路追蹤

適用於

另請參閱