IPGlobalStatistics 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
提供網際網路協定(IP)統計資料。
public ref class IPGlobalStatistics abstract
public abstract class IPGlobalStatistics
type IPGlobalStatistics = class
Public MustInherit Class IPGlobalStatistics
- 繼承
-
IPGlobalStatistics
範例
以下程式碼範例顯示 IP 統計數據。
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("");
}
備註
此類別被 GetIPv4GlobalStatistics 和 GetIPv6GlobalStatistics 方法用來回傳 IP 流量資訊。
網際網路協定用於將 IP 封包從來源電腦傳送到目的地電腦。 IP 也負責將過大的封包分割成多個足夠小以便傳輸的封包,這個過程稱為分段。
此類別的屬性對應於 IETF RFC 2011 中定義的 IP 管理資訊庫物件。
建構函式
| 名稱 | Description |
|---|---|
| IPGlobalStatistics() |
初始化 IPGlobalStatistics 類別的新執行個體。 |
屬性
| 名稱 | Description |
|---|---|
| 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 |
取得本地機器接收到的網際網路協定(IP)封包數量,標頭中包含未知協定。 |
方法
| 名稱 | Description |
|---|---|
| Equals(Object) |
判斷指定的物件是否等於目前的物件。 (繼承來源 Object) |
| GetHashCode() |
做為預設哈希函式。 (繼承來源 Object) |
| GetType() |
取得目前實例的 Type。 (繼承來源 Object) |
| MemberwiseClone() |
建立目前 Object的淺層複本。 (繼承來源 Object) |
| ToString() |
傳回表示目前 物件的字串。 (繼承來源 Object) |