IPGlobalStatistics 类

定义

提供 Internet 协议 (IP) 统计数据。

public ref class IPGlobalStatistics abstract
public abstract class IPGlobalStatistics
type IPGlobalStatistics = class
Public MustInherit Class IPGlobalStatistics
继承
IPGlobalStatistics

示例

以下代码示例显示 IP 统计信息。

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( "" );
}
public static void ShowIPStatistics(NetworkInterfaceComponent version)
{
    IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
    IPGlobalStatistics ipstat = null;
    switch (version)
    {
        case NetworkInterfaceComponent.IPv4:
             ipstat = properties.GetIPv4GlobalStatistics();
           Console.WriteLine("{0}IPv4 Statistics ",Environment.NewLine);
            break;
        case NetworkInterfaceComponent.IPv6:
            ipstat = properties.GetIPv6GlobalStatistics();
            Console.WriteLine("{0}IPv6 Statistics ",Environment.NewLine);
            break;
        default:
            throw new 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("");
}

注解

此类由 GetIPv4GlobalStatisticsGetIPv6GlobalStatistics 方法用于返回 IP 流量信息。

Internet 协议用于将 IP 数据包从源计算机移动到目标计算机。 IP 还处理将过大的数据包拆分为多个足够小的数据包以用于传输的过程称为碎片。

此类中的属性与 IETF RFC 2011 中定义的 IP 的管理信息基对象相关联。

构造函数

IPGlobalStatistics()

初始化 IPGlobalStatistics 类的新实例。

属性

DefaultTtl

获取 Internet 协议 (IP) 数据包的默认生存时间 (TTL) 值。

ForwardingEnabled

获取 Boolean 值,该值指定是否启用 Internet 协议 (IP) 数据包转发。

NumberOfInterfaces

获取网络接口数。

NumberOfIPAddresses

获取分配给本地计算机的 Internet 协议 (IP) 地址数。

NumberOfRoutes

获取 Internet 协议 (IP) 路由表中的路由数。

OutputPacketRequests

获取出站 Internet 协议 (IP) 数据包数。

OutputPacketRoutingDiscards

获取已从路由表中丢弃的路由数。

OutputPacketsDiscarded

获取已丢弃的已传输 Internet 协议 (IP) 数据包数。

OutputPacketsWithNoRoute

获取本地计算机未能确定其目标地址路由的 Internet 协议 (IP) 数据包数。

PacketFragmentFailures

获取未能分段的 Internet 协议 (IP) 数据包数。

PacketReassembliesRequired

获取需要重新组合的 Internet 协议 (IP) 数据包数。

PacketReassemblyFailures

获取没有成功重新组合的 Internet 协议 (IP) 数据包数。

PacketReassemblyTimeout

获取 Internet 协议 (IP) 数据包的所有段必须到达的最长时限。

PacketsFragmented

获取分段的 Internet 协议 (IP) 数据包数。

PacketsReassembled

获取重新组合的 Internet 协议 (IP) 数据包数。

ReceivedPackets

获取收到的 Internet 协议 (IP) 数据包数。

ReceivedPacketsDelivered

获取传送的 Internet 协议 (IP) 数据包数。

ReceivedPacketsDiscarded

获取已收到但被丢弃的 Internet 协议 (IP) 数据包数。

ReceivedPacketsForwarded

获取转发的 Internet 协议 (IP) 数据包数。

ReceivedPacketsWithAddressErrors

获取收到的地址有错误的 Internet 协议 (IP) 数据包数。

ReceivedPacketsWithHeadersErrors

获取收到的标头有错误的 Internet 协议 (IP) 数据包数。

ReceivedPacketsWithUnknownProtocol

获取在本地计算机上收到的、标头中有未知协议的 Internet 协议 (IP) 数据包数。

方法

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
ToString()

返回表示当前对象的字符串。

(继承自 Object)

适用于