IPGlobalProperties.GetIcmpV4Statistics Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Tillhandahåller statistiska data för Internet Control Message Protocol (ICMP) version 4 för den lokala datorn.
public:
abstract System::Net::NetworkInformation::IcmpV4Statistics ^ GetIcmpV4Statistics();
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract System.Net.NetworkInformation.IcmpV4Statistics GetIcmpV4Statistics();
public abstract System.Net.NetworkInformation.IcmpV4Statistics GetIcmpV4Statistics();
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
abstract member GetIcmpV4Statistics : unit -> System.Net.NetworkInformation.IcmpV4Statistics
abstract member GetIcmpV4Statistics : unit -> System.Net.NetworkInformation.IcmpV4Statistics
Public MustOverride Function GetIcmpV4Statistics () As IcmpV4Statistics
Returer
Ett IcmpV4Statistics objekt som tillhandahåller trafikstatistik för ICMP version 4 för den lokala datorn.
- Attribut
Undantag
Win32-funktionen GetIcmpStatistics misslyckades.
Exempel
I följande exempel visas aktuell ICMPv4-statistik.
public static void ShowIcmpV4Statistics()
{
IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
IcmpV4Statistics stat = properties.GetIcmpV4Statistics();
Console.WriteLine("ICMP V4 Statistics:");
Console.WriteLine(" Messages ............................ Sent: {0,-10} Received: {1,-10}",
stat.MessagesSent, stat.MessagesReceived);
Console.WriteLine(" Errors .............................. Sent: {0,-10} Received: {1,-10}",
stat.ErrorsSent, stat.ErrorsReceived);
Console.WriteLine(" Echo Requests ....................... Sent: {0,-10} Received: {1,-10}",
stat.EchoRequestsSent, stat.EchoRequestsReceived);
Console.WriteLine(" Echo Replies ........................ Sent: {0,-10} Received: {1,-10}",
stat.EchoRepliesSent, stat.EchoRepliesReceived);
Console.WriteLine(" Destination Unreachables ............ Sent: {0,-10} Received: {1,-10}",
stat.DestinationUnreachableMessagesSent, stat.DestinationUnreachableMessagesReceived);
Console.WriteLine(" Source Quenches ..................... Sent: {0,-10} Received: {1,-10}",
stat.SourceQuenchesSent, stat.SourceQuenchesReceived);
Console.WriteLine(" Redirects ........................... Sent: {0,-10} Received: {1,-10}",
stat.RedirectsSent, stat.RedirectsReceived);
Console.WriteLine(" TimeExceeded ........................ Sent: {0,-10} Received: {1,-10}",
stat.TimeExceededMessagesSent, stat.TimeExceededMessagesReceived);
Console.WriteLine(" Parameter Problems .................. Sent: {0,-10} Received: {1,-10}",
stat.ParameterProblemsSent, stat.ParameterProblemsReceived);
Console.WriteLine(" Timestamp Requests .................. Sent: {0,-10} Received: {1,-10}",
stat.TimestampRequestsSent, stat.TimestampRequestsReceived);
Console.WriteLine(" Timestamp Replies ................... Sent: {0,-10} Received: {1,-10}",
stat.TimestampRepliesSent, stat.TimestampRepliesReceived);
Console.WriteLine(" Address Mask Requests ............... Sent: {0,-10} Received: {1,-10}",
stat.AddressMaskRequestsSent, stat.AddressMaskRequestsReceived);
Console.WriteLine(" Address Mask Replies ................ Sent: {0,-10} Received: {1,-10}",
stat.AddressMaskRepliesSent, stat.AddressMaskRepliesReceived);
Console.WriteLine("");
}
Kommentarer
ICMP är en uppsättning meddelanden för användning med Internet Protocol version 4 (IPv4). ICMP används av IPv4-noder för att rapportera fel som påträffas vid bearbetning av datapaket och för att utföra andra Internetlagerfunktioner. ICMP version 4 definieras i IETF RFC 792.
Mer information om trafikstatistiken för ICMP version 4 som är tillgänglig för program finns i klassdokumentationen IcmpV4Statistics . Observera att objektet IcmpV4Statistics som returneras av den här metoden återspeglar statistiken från och med den tidpunkt då objektet skapas. Den här informationen uppdateras inte dynamiskt.