IPGlobalStatistics Class

Provides Internet Protocol (IP) statistical data.

System::Object
  System.Net.NetworkInformation::IPGlobalStatistics

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

public ref class IPGlobalStatistics abstract

The IPGlobalStatistics type exposes the following members.

  NameDescription
Protected methodIPGlobalStatisticsInitializes a new instance of the IPGlobalStatistics class.
Top

  NameDescription
Public propertyDefaultTtlGets the default time-to-live (TTL) value for Internet Protocol (IP) packets.
Public propertyForwardingEnabledGets a Boolean value that specifies whether Internet Protocol (IP) packet forwarding is enabled.
Public propertyNumberOfInterfacesGets the number of network interfaces.
Public propertyNumberOfIPAddressesGets the number of Internet Protocol (IP) addresses assigned to the local computer.
Public propertyNumberOfRoutesGets the number of routes in the Internet Protocol (IP) routing table.
Public propertyOutputPacketRequestsGets the number of outbound Internet Protocol (IP) packets.
Public propertyOutputPacketRoutingDiscardsGets the number of routes that have been discarded from the routing table.
Public propertyOutputPacketsDiscardedGets the number of transmitted Internet Protocol (IP) packets that have been discarded.
Public propertyOutputPacketsWithNoRouteGets the number of Internet Protocol (IP) packets for which the local computer could not determine a route to the destination address.
Public propertyPacketFragmentFailuresGets the number of Internet Protocol (IP) packets that could not be fragmented.
Public propertyPacketReassembliesRequiredGets the number of Internet Protocol (IP) packets that required reassembly.
Public propertyPacketReassemblyFailuresGets the number of Internet Protocol (IP) packets that were not successfully reassembled.
Public propertyPacketReassemblyTimeoutGets the maximum amount of time within which all fragments of an Internet Protocol (IP) packet must arrive.
Public propertyPacketsFragmentedGets the number of Internet Protocol (IP) packets fragmented.
Public propertyPacketsReassembledGets the number of Internet Protocol (IP) packets reassembled.
Public propertyReceivedPacketsGets the number of Internet Protocol (IP) packets received.
Public propertyReceivedPacketsDeliveredGets the number of Internet Protocol (IP) packets delivered.
Public propertyReceivedPacketsDiscardedGets the number of Internet Protocol (IP) packets that have been received and discarded.
Public propertyReceivedPacketsForwardedGets the number of Internet Protocol (IP) packets forwarded.
Public propertyReceivedPacketsWithAddressErrorsGets the number of Internet Protocol (IP) packets with address errors that were received.
Public propertyReceivedPacketsWithHeadersErrorsGets the number of Internet Protocol (IP) packets with header errors that were received.
Public propertyReceivedPacketsWithUnknownProtocolGets the number of Internet Protocol (IP) packets received on the local machine with an unknown protocol in the header.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

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.

void ShowIPStatistics( NetworkInterfaceComponent version )
{
   IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties();
   IPGlobalStatistics ^ ipstat = nullptr;
   switch ( version )
   {
      case NetworkInterfaceComponent::IPv4:
         ipstat = properties->GetIPv4GlobalStatistics();
         Console::WriteLine( "{0}IPv4 Statistics ", Environment::NewLine );
         break;

      case NetworkInterfaceComponent::IPv6:
         ipstat = properties->GetIPv4GlobalStatistics();
         Console::WriteLine( "{0}IPv6 Statistics ", Environment::NewLine );
         break;

      default:
         throw gcnew ArgumentException( "version" );
         break;
   }

   Console::WriteLine( "  Forwarding enabled ...................... : {0}",
      ipstat->ForwardingEnabled );
   Console::WriteLine( "  Interfaces .............................. : {0}",
      ipstat->NumberOfInterfaces );
   Console::WriteLine( "  IP addresses ............................ : {0}",
      ipstat->NumberOfIPAddresses );
   Console::WriteLine( "  Routes .................................. : {0}",
      ipstat->NumberOfRoutes );
   Console::WriteLine( "  Default TTL ............................. : {0}",
      ipstat->DefaultTtl );
   Console::WriteLine( "" );
   Console::WriteLine( "  Inbound Packet Data:" );
   Console::WriteLine( "      Received ............................ : {0}",
      ipstat->ReceivedPackets );
   Console::WriteLine( "      Forwarded ........................... : {0}",
      ipstat->ReceivedPacketsForwarded );
   Console::WriteLine( "      Delivered ........................... : {0}",
      ipstat->ReceivedPacketsDelivered );
   Console::WriteLine( "      Discarded ........................... : {0}",
      ipstat->ReceivedPacketsDiscarded );
   Console::WriteLine( "      Header Errors ....................... : {0}",
      ipstat->ReceivedPacketsWithHeadersErrors );
   Console::WriteLine( "      Address Errors ...................... : {0}",
      ipstat->ReceivedPacketsWithAddressErrors );
   Console::WriteLine( "      Unknown Protocol Errors ............. : {0}",
      ipstat->ReceivedPacketsWithUnknownProtocol );
   Console::WriteLine( "" );
   Console::WriteLine( "  Outbound Packet Data:" );
   Console::WriteLine( "      Requested ........................... : {0}",
      ipstat->OutputPacketRequests );
   Console::WriteLine( "      Discarded ........................... : {0}",
      ipstat->OutputPacketsDiscarded );
   Console::WriteLine( "      No Routing Discards ................. : {0}",
      ipstat->OutputPacketsWithNoRoute );
   Console::WriteLine( "      Routing Entry Discards .............. : {0}",
      ipstat->OutputPacketRoutingDiscards );
   Console::WriteLine( "" );
   Console::WriteLine( "  Reassembly Data:" );
   Console::WriteLine( "      Reassembly Timeout .................. : {0}",
      ipstat->PacketReassemblyTimeout );
   Console::WriteLine( "      Reassemblies Required ............... : {0}",
      ipstat->PacketReassembliesRequired );
   Console::WriteLine( "      Packets Reassembled ................. : {0}",
      ipstat->PacketsReassembled );
   Console::WriteLine( "      Packets Fragmented .................. : {0}",
      ipstat->PacketsFragmented );
   Console::WriteLine( "      Fragment Failures ................... : {0}",
      ipstat->PacketFragmentFailures );
   Console::WriteLine( "" );
}

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft