PingCompletedEventArgs.Reply プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
インターネット制御メッセージ プロトコル (ICMP) エコー要求メッセージの送信と対応する ICMP エコー応答メッセージの受信の試行を記述するデータを含むオブジェクトを取得します。
public:
property System::Net::NetworkInformation::PingReply ^ Reply { System::Net::NetworkInformation::PingReply ^ get(); };
public System.Net.NetworkInformation.PingReply? Reply { get; }
public System.Net.NetworkInformation.PingReply Reply { get; }
member this.Reply : System.Net.NetworkInformation.PingReply
Public ReadOnly Property Reply As PingReply
プロパティ値
ICMP エコー要求の結果を記述する PingReply オブジェクト。
例
次のコード例では、 PingCompleted イベントへの応答に使用されるメソッドを実装します。 完全な例については、 PingCompletedEventArgs クラスの概要を参照してください。
private static void PingCompletedCallback (object sender, PingCompletedEventArgs e)
{
// If the operation was canceled, display a message to the user.
if (e.Cancelled)
{
Console.WriteLine ("Ping canceled.");
// Let the main thread resume.
// UserToken is the AutoResetEvent object that the main thread
// is waiting for.
((AutoResetEvent)e.UserState).Set ();
}
// If an error occurred, display the exception to the user.
if (e.Error != null)
{
Console.WriteLine ("Ping failed:");
Console.WriteLine (e.Error.ToString ());
// Let the main thread resume.
((AutoResetEvent)e.UserState).Set();
}
PingReply reply = e.Reply;
DisplayReply (reply);
// Let the main thread resume.
((AutoResetEvent)e.UserState).Set();
}
注釈
Statusの値がSuccessされていない場合は、RoundtripTime、Options、およびBufferプロパティによって返される値を使用しないでください。
RoundtripTimeプロパティとBuffer プロパティは 0 を返し、Options プロパティはnullを返します。