PingCompletedEventArgs.Reply Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Recebe um objeto que contém dados que descrevem uma tentativa de enviar uma mensagem de eco do Internet Control Message Protocol (ICMP) e recebe uma correspondente mensagem de resposta de eco 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
Valor de Propriedade
Um PingReply objeto que descreve os resultados do pedido de eco ICMP.
Exemplos
O seguinte exemplo de código implementa um método que é usado para responder a um PingCompleted evento. Para o exemplo completo, consulte a visão geral da PingCompletedEventArgs classe.
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();
}
Observações
Se o valor de Status não for , não deve usar os valores que são devolvidos pelas Successpropriedades , RoundtripTime, e OptionsBuffer. As RoundtripTime propriedades e Buffer retornarão zero, e a Options propriedade devolverá null.