共用方式為


Ping.PingCompleted 事件

定義

當傳送網際網路控制訊息通訊協定 (ICMP) 回應訊息及接收對應之 ICMP 回應回覆訊息的非同步作業完成或取消時發生。

public:
 event System::Net::NetworkInformation::PingCompletedEventHandler ^ PingCompleted;
public event System.Net.NetworkInformation.PingCompletedEventHandler? PingCompleted;
public event System.Net.NetworkInformation.PingCompletedEventHandler PingCompleted;
member this.PingCompleted : System.Net.NetworkInformation.PingCompletedEventHandler 
Public Custom Event PingCompleted As PingCompletedEventHandler 
Public Event PingCompleted As PingCompletedEventHandler 

事件類型

範例

下列程式代碼範例示範如何指定 事件的回呼方法 PingCompleted 。 類別概 Ping 觀中提供完整的範例。

Ping ^ pingSender = gcnew Ping;

// When the PingCompleted event is raised,
// the PingCompletedCallback method is called.
pingSender->PingCompleted += gcnew PingCompletedEventHandler( PingCompletedCallback );
Ping pingSender = new Ping ();

// When the PingCompleted event is raised,
// the PingCompletedCallback method is called.
pingSender.PingCompleted += new PingCompletedEventHandler (PingCompletedCallback);

備註

應用程式會 PingCompleted 使用 事件來取得呼叫其中一 SendAsync 種方法所收集之完成狀態和數據的相關信息。 委派 PingCompletedEventHandler 會提供引發這個事件時 SendAsync 叫用的回呼方法。

適用於