Export (0) Print
Expand All

IPGlobalStatistics Class

Provides Internet Protocol (IP) statistical data.

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

public abstract class IPGlobalStatistics

This class is used by the GetIPv4GlobalStatistics and GetIPv6GlobalStatistics methods to return IP traffic information.

The Internet protocol is used to move IP packets from a source computer to a destination computer. IP also handles dividing a packet that is too large into multiple packets that are small enough for transport, in a process known as fragmentation.

The properties in this class correlate to the Management Information Base objects for IP defined in IETF RFC 2011.

The following code code example displays IP statistics.

No code example is currently available or this language may not be supported.
void ShowIPStatistics(NetworkInterfaceComponent version)
{
    IPGlobalProperties* properties = IPGlobalProperties::GetIPGlobalProperties();
    IPGlobalStatistics* ipstat = 0;
    switch (version)
    {
    case NetworkInterfaceComponent::IPv4:
        ipstat = properties->GetIPv4GlobalStatistics();
        Console::WriteLine(S"{0}IPv4 Statistics ",Environment::NewLine);
        break;
    case NetworkInterfaceComponent::IPv6:
        ipstat = properties->GetIPv4GlobalStatistics();
        Console::WriteLine(S"{0}IPv6 Statistics ",Environment::NewLine);
        break;
    default:
        throw new ArgumentException(S"version");
        break;
    }
    Console::WriteLine(S"  Forwarding enabled ...................... : {0}", __box(ipstat->ForwardingEnabled));
    Console::WriteLine(S"  Interfaces .............................. : {0}", __box(ipstat->Interfaces));
    Console::WriteLine(S"  IP addresses ............................ : {0}", __box(ipstat->IPAddresses));
    Console::WriteLine(S"  Routes .................................. : {0}", __box(ipstat->Routes));
    Console::WriteLine(S"  Default TTL ............................. : {0}", __box(ipstat->DefaultTtl));
    Console::WriteLine(S"");    
    Console::WriteLine(S"  Inbound Packet Data:");
    Console::WriteLine(S"      Received ............................ : {0}", __box(ipstat->ReceivedPackets));
    Console::WriteLine(S"      Forwarded ........................... : {0}", __box(ipstat->ReceivedPacketsForwarded));
    Console::WriteLine(S"      Delivered ........................... : {0}", __box(ipstat->ReceivedPacketsDelivered));
    Console::WriteLine(S"      Discarded ........................... : {0}", __box(ipstat->ReceivedPacketsDiscarded));
    Console::WriteLine(S"      Header Errors ....................... : {0}", __box(ipstat->ReceivedPacketsWithHeadersErrors));
    Console::WriteLine(S"      Address Errors ...................... : {0}", __box(ipstat->ReceivedPacketsWithAddressErrors));
    Console::WriteLine(S"      Unknown Protocol Errors ............. : {0}", __box(ipstat->ReceivedPacketsWithUnknownProtocol));
    Console::WriteLine(S"");    
    Console::WriteLine(S"  Outbound Packet Data:");
    Console::WriteLine(S"      Requested ........................... : {0}", __box(ipstat->OutputPacketRequests));
    Console::WriteLine(S"      Discarded ........................... : {0}", __box(ipstat->OutputPacketsDiscarded));
    Console::WriteLine(S"      No Routing Discards ................. : {0}", __box(ipstat->OutputPacketsWithNoRoute));
    Console::WriteLine(S"      Routing Entry Discards .............. : {0}", __box(ipstat->OutputPacketRoutingDiscards));
    Console::WriteLine(S"");    
    Console::WriteLine(S"  Reassembly Data:");
    Console::WriteLine(S"      Reassembly Timeout .................. : {0}", __box(ipstat->PacketReassemblyTimeout));
    Console::WriteLine(S"      Reassemblies Required ............... : {0}", __box(ipstat->PacketReassembliesRequired));
    Console::WriteLine(S"      Packets Reassembled ................. : {0}", __box(ipstat->PacketsReassembled));
    Console::WriteLine(S"      Packets Fragmented .................. : {0}", __box(ipstat->PacketsFragmented));
    Console::WriteLine(S"      Fragment Failures ................... : {0}", __box(ipstat->PacketFragmentFailures));
    Console::WriteLine(S"");
}

System.Object
  System.Net.NetworkInformation.IPGlobalStatistics

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

Community Additions

ADD
Show:
© 2014 Microsoft