다음을 통해 공유


PingCompletedEventArgs.Reply 속성

정의

ICMP(Internet Control Message Protocol) 에코 요청 메시지를 보내고 해당 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

속성 값

PingReply ICMP 에코 요청의 결과를 설명하는 개체입니다.

예제

다음 코드 예제에서는 이벤트에 응답 하는 데 사용 되는 메서드를 구현 합니다 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경우 , OptionsBuffer 속성에서 반환RoundtripTime하는 값을 사용하면 안 됩니다. 및 속성은 RoundtripTime 0을 반환하고 속성은 Options 반환null됩니다.Buffer

적용 대상