PingReply.Options 속성

정의

ICMP(Internet Control Message Protocol) Echo Request에 대한 회신을 전송하는 데 사용된 옵션을 가져옵니다.

public:
 property System::Net::NetworkInformation::PingOptions ^ Options { System::Net::NetworkInformation::PingOptions ^ get(); };
public System.Net.NetworkInformation.PingOptions? Options { get; }
public System.Net.NetworkInformation.PingOptions Options { get; }
member this.Options : System.Net.NetworkInformation.PingOptions
Public ReadOnly Property Options As PingOptions

속성 값

PingOptionsStatus이면 회신을 전송하는 데 사용된 TTL(Time to Live) 및 조각화 지시문이 들어 있는 Success 개체이고, 그렇지 않으면 null입니다.

예제

다음 코드 예제에서는 동기적으로 ICMP 에코 요청을 보내고이 속성에서 반환 하는 개체에 PingOptions 저장 된 값을 표시 합니다.

void LocalPing()
{
   
   // Ping's the local machine.
   Ping ^ pingSender = gcnew Ping;
   IPAddress^ address = IPAddress::Loopback;
   PingReply ^ reply = pingSender->Send( address );
   if ( reply->Status == IPStatus::Success )
   {
      Console::WriteLine( "Address: {0}", reply->Address->ToString() );
      Console::WriteLine( "RoundTrip time: {0}", reply->RoundtripTime );
      Console::WriteLine( "Time to live: {0}", reply->Options->Ttl );
      Console::WriteLine( "Don't fragment: {0}", reply->Options->DontFragment );
      Console::WriteLine( "Buffer size: {0}", reply->Buffer->Length );
   }
   else
   {
      Console::WriteLine( reply->Status );
   }
}
public static void LocalPing ()
{
    // Ping's the local machine.
    Ping pingSender = new Ping ();
    IPAddress address = IPAddress.Loopback;
    PingReply reply = pingSender.Send (address);

    if (reply.Status == IPStatus.Success)
    {
        Console.WriteLine ("Address: {0}", reply.Address.ToString ());
        Console.WriteLine ("RoundTrip time: {0}", reply.RoundtripTime);
        Console.WriteLine ("Time to live: {0}", reply.Options.Ttl);
        Console.WriteLine ("Don't fragment: {0}", reply.Options.DontFragment);
        Console.WriteLine ("Buffer size: {0}", reply.Buffer.Length);
    }
    else
    {
        Console.WriteLine (reply.Status);
    }
}

설명

TTL은 노드가 원본과 대상 간에 이동할 때 패킷을 전달할 수 있는 횟수를 정의합니다. 홉이라고도 하는 전달 수가 TTL에 지정된 값을 초과하면 패킷은 배달할 수 없는 것으로 간주되어 삭제됩니다.

ICMP 에코 요청에 지정된 값은 DontFragment 패킷 조각화를 제어합니다. 가 true 이고 패킷 크기가 패킷에서 가져온 네트워크 경로의 최대 전송 단위를 초과하는 경우 DontFragment 패킷이 삭제되고 PacketTooBig 오류가 반환됩니다.

적용 대상