PingReply.Buffer 속성

정의

ICMP(Internet Control Message Protocol) Echo Reply 메시지에서 받은 데이터의 버퍼를 가져옵니다.

public:
 property cli::array <System::Byte> ^ Buffer { cli::array <System::Byte> ^ get(); };
public byte[] Buffer { get; }
member this.Buffer : byte[]
Public ReadOnly Property Buffer As Byte()

속성 값

Byte[]

ICMP Echo Reply 메시지에서 받은 데이터가 들어 있는 Byte 배열이거나, 받은 회신이 없는 경우 빈 문자열입니다.

예제

다음 코드 예제에서는 동기적으로 ICMP 에코 요청을 보내고이 속성에서 반환 하는 버퍼의 크기를 표시 합니다.

void ComplexPing()
{
   Ping ^ pingSender = gcnew Ping;
   
   // Create a buffer of 32 bytes of data to be transmitted.
   String^ data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
   array<Byte>^buffer = Encoding::ASCII->GetBytes( data );
   
   // Wait 10 seconds for a reply.
   int timeout = 10000;
   
   // Set options for transmission:
   // The data can go through 64 gateways or routers
   // before it is destroyed, and the data packet
   // cannot be fragmented.
   PingOptions ^ options = gcnew PingOptions( 64,true );
   
   // Send the request.
   PingReply ^ reply = pingSender->Send( "www.contoso.com", timeout, buffer, options );
   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 ComplexPing ()
{
    Ping pingSender = new Ping ();

    // Create a buffer of 32 bytes of data to be transmitted.
    string data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
    byte[] buffer = Encoding.ASCII.GetBytes (data);

    // Wait 10 seconds for a reply.
    int timeout = 10000;

    // Set options for transmission:
    // The data can go through 64 gateways or routers
    // before it is destroyed, and the data packet
    // cannot be fragmented.
    PingOptions options = new PingOptions (64, true);

    // Send the request.
    PingReply reply = pingSender.Send ("www.contoso.com", timeout, buffer, options);

    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);
    }
}

설명

ICMP 에코 요청과 함께 전송된 데이터 버퍼는 알려진 크기의 패킷에 대한 왕복 이동 시간을 계산할 수 있도록 에코 응답의 보낸 사람에게 반환됩니다. 옵션과 결합된 데이터 버퍼를 DontFragment 사용하여 원본 컴퓨터와 대상 컴퓨터 간의 네트워크 경로에 대한 최대 전송 단위를 검색할 수 있습니다. 자세한 내용은 에서 제공되는 https://www.ietf.orgRFC 1574 섹션 3.2의 "추적 경로"를 참조하세요.

SendAsyncSend 사용되는 기본 버퍼에는 32바이트의 데이터가 포함됩니다.

적용 대상