Bagikan melalui


PingReply.Address Properti

Definisi

Mendapatkan alamat host yang mengirim balasan gema Internet Control Message Protocol (ICMP).

public:
 property System::Net::IPAddress ^ Address { System::Net::IPAddress ^ get(); };
public System.Net.IPAddress Address { get; }
member this.Address : System.Net.IPAddress
Public ReadOnly Property Address As IPAddress

Nilai Properti

Yang IPAddress berisi tujuan untuk pesan gema ICMP.

Contoh

Contoh kode berikut mengirimkan permintaan gema ICMP secara sinkron dan menampilkan nilai properti ini.

void SimplePing()
{
   Ping ^ pingSender = gcnew Ping;
   PingReply ^ reply = pingSender->Send( "www.contoso.com" );
   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 SimplePing ()
{
    Ping pingSender = new Ping ();
    PingReply reply = pingSender.Send ("www.contoso.com");

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

Keterangan

yang Address dikembalikan oleh salah Send satu kelebihan beban dapat berasal dari komputer jarak jauh yang berbahaya. Jangan sambungkan ke komputer jarak jauh menggunakan alamat ini. Gunakan DNS untuk menentukan alamat IP komputer yang ingin Anda sambungkan.

Berlaku untuk