共用方式為


IPGlobalStatistics 類別

定義

提供網際網路通訊協定 (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("");
}

備註

GetIPv6GlobalStatistics 方法會使用此GetIPv4GlobalStatistics類別來傳回IP流量資訊。

因特網通訊協定可用來將IP封包從來源電腦移至目的地計算機。 IP 也會處理在稱為片段的進程中,將太大的封包分割成足以傳輸的多個封包。

此類別中的屬性會與IETF RFC 2011 中定義的IP管理資訊基底物件相互關聯。

建構函式

IPGlobalStatistics()

初始化 IPGlobalStatistics 類別的新執行個體。

屬性

DefaultTtl

取得網際網路通訊協定 (IP) 封包的預設存留時間 (TTL) 值。

ForwardingEnabled

取得 Boolean 值,指定是否已啟用網際網路通訊協定 (IP) 封包轉送。

NumberOfInterfaces

取得網路介面的數目。

NumberOfIPAddresses

取得指派給本機電腦的網際網路通訊協定 (IP) 位址數目。

NumberOfRoutes

取得網際網路通訊協定 (IP) 路由表中的路徑數目。

OutputPacketRequests

取得傳出網際網路通訊協定 (IP) 封包的數目。

OutputPacketRoutingDiscards

取得已從路由表中捨棄的路徑數目。

OutputPacketsDiscarded

取得已捨棄的傳送網際網路通訊協定 (IP) 封包數目。

OutputPacketsWithNoRoute

取得本機電腦無法判斷其目的位址之路徑的網際網路通訊協定 (IP) 封包數目。

PacketFragmentFailures

取得無法分散的網際網路通訊協定 (IP) 封包數目。

PacketReassembliesRequired

取得需要重組的網際網路通訊協定 (IP) 封包數目。

PacketReassemblyFailures

取得未成功重組的網際網路通訊協定 (IP) 封包數目。

PacketReassemblyTimeout

取得時間上限,網際網路通訊協定 (IP) 封包的所有片段都必須在該時間內到達。

PacketsFragmented

取得分散的網際網路通訊協定 (IP) 封包數目。

PacketsReassembled

取得重組的網際網路通訊協定 (IP) 封包數目。

ReceivedPackets

取得已收到的網際網路通訊協定 (IP) 封包數目。

ReceivedPacketsDelivered

取得已傳遞的網際網路通訊協定 (IP) 封包數目。

ReceivedPacketsDiscarded

取得已收到並捨棄的網際網路通訊協定 (IP) 封包數目。

ReceivedPacketsForwarded

取得已轉送的網際網路通訊協定 (IP) 封包數目。

ReceivedPacketsWithAddressErrors

取得已收到且具有位址錯誤的網際網路通訊協定 (IP) 封包數目。

ReceivedPacketsWithHeadersErrors

取得已收到且具有標頭錯誤的網際網路通訊協定 (IP) 封包數目。

ReceivedPacketsWithUnknownProtocol

取得已在本機電腦 (Local Machine) 上收到,且標頭中含有未知通訊協定的網際網路通訊協定 (IP) 封包數目。

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於