PingReply.Address Eigenschaft

Definition

Ruft die Adresse des Hosts ab, der die ICMP (Internet Control Message Protocol)-Echoantwort sendet.Gets the address of the host that sends the Internet Control Message Protocol (ICMP) echo reply.

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

Eigenschaftswert

Eine IPAddress, die das Ziel für die ICMP-Echomeldung enthält.An IPAddress containing the destination for the ICMP echo message.

Beispiele

Im folgenden Codebeispiel wird eine ICMP-Echo Anforderung synchron gesendet und der Wert dieser Eigenschaft angezeigt.The following code example sends an ICMP echo request synchronously and displays the value of this property.

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

Hinweise

Der Address , der von einer Send der-über Ladungen zurückgegeben wurde, kann von einem bösartigen Remote Computer stammen.The Address returned by any of the Send overloads can originate from a malicious remote computer. Stellen Sie keine Verbindung mit dem Remote Computer her, indem Sie diese Adresse verwenden.Do not connect to the remote computer using this address. Verwenden Sie DNS, um die IP-Adresse des Computers zu ermitteln, mit dem Sie eine Verbindung herstellen möchten.Use DNS to determine the IP address of the machine to which you want to connect.

Gilt für: