IcmpV4Statistics Class

Provides Internet Control Message Protocol for IPv4 (ICMPv4) statistical data for the local computer.

Namespace:  System.Net.NetworkInformation
Assembly:  System (in System.dll)

public abstract class IcmpV4Statistics

ICMPv4 is a set of error and informational messages for use with Internet Protocol version 4. ICMP version 4 is defined in IETF RFC 792.

This class is used by the GetIcmpV4Statistics method to return ICMPv4 traffic information.

The following example displays the current ICMPv4 statistics.

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("");
}
void ShowIcmpV4Statistics()
{
    IPGlobalProperties* properties = IPGlobalProperties::GetIPGlobalProperties();
    IcmpV4Statistics* stat = properties->GetIcmpV4Statistics();
    Console::WriteLine(S"ICMP V4 Statistics:");

    Console::WriteLine(S"  Messages ............................ Sent: {0,-10}   Received: {1,-10}",
        __box(stat->MessagesSent), __box(stat->MessagesReceived));
    Console::WriteLine(S"  Errors .............................. Sent: {0,-10}   Received: {1,-10}",
        __box(stat->ErrorsSent), __box(stat->ErrorsReceived));
    Console::WriteLine(S"  Echo Requests ....................... Sent: {0,-10}   Received: {1,-10}",
        __box(stat->EchoRequestsSent), __box(stat->EchoRequestsReceived));
    Console::WriteLine(S"  Echo Replies ........................ Sent: {0,-10}   Received: {1,-10}",
        __box(stat->EchoRepliesSent), __box(stat->EchoRepliesReceived));
    Console::WriteLine(S"  Destination Unreachables ............ Sent: {0,-10}   Received: {1,-10}",
        __box(stat->DestinationUnreachableMessagesSent), __box(stat->DestinationUnreachableMessagesReceived));
    Console::WriteLine(S"  Source Quenches ..................... Sent: {0,-10}   Received: {1,-10}",
        __box(stat->SourceQuenchesSent), __box(stat->SourceQuenchesReceived));
    Console::WriteLine(S"  Redirects ........................... Sent: {0,-10}   Received: {1,-10}",
        __box(stat->RedirectsSent), __box(stat->RedirectsReceived));  
    Console::WriteLine(S"  TimeExceeded ........................ Sent: {0,-10}   Received: {1,-10}",
        __box(stat->TimeExceededMessagesSent), __box(stat->TimeExceededMessagesReceived));
    Console::WriteLine(S"  Parameter Problems .................. Sent: {0,-10}   Received: {1,-10}",
        __box(stat->ParameterProblemsSent), __box(stat->ParameterProblemsReceived));        
    Console::WriteLine(S"  Timestamp Requests .................. Sent: {0,-10}   Received: {1,-10}",
        __box(stat->TimestampRequestsSent), __box(stat->TimestampRequestsReceived));    
    Console::WriteLine(S"  Timestamp Replies ................... Sent: {0,-10}   Received: {1,-10}",
        __box(stat->TimestampRepliesSent), __box(stat->TimestampRepliesReceived));    
    Console::WriteLine(S"  Address Mask Requests ............... Sent: {0,-10}   Received: {1,-10}",
        __box(stat->AddressMaskRequestsSent), __box(stat->AddressMaskRequestsReceived));    
    Console::WriteLine(S"  Address Mask Replies ................ Sent: {0,-10}   Received: {1,-10}",
        __box(stat->AddressMaskRepliesSent), __box(stat->AddressMaskRepliesReceived));                    
    Console::WriteLine(S"");    
}

System.Object
  System.Net.NetworkInformation.IcmpV4Statistics

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft