IPGlobalProperties.GetIcmpV4Statistics 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
提供網際網路控制訊息協定(ICMP)第4版的本地電腦統計資料。
public:
abstract System::Net::NetworkInformation::IcmpV4Statistics ^ GetIcmpV4Statistics();
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract System.Net.NetworkInformation.IcmpV4Statistics GetIcmpV4Statistics();
public abstract System.Net.NetworkInformation.IcmpV4Statistics GetIcmpV4Statistics();
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
abstract member GetIcmpV4Statistics : unit -> System.Net.NetworkInformation.IcmpV4Statistics
abstract member GetIcmpV4Statistics : unit -> System.Net.NetworkInformation.IcmpV4Statistics
Public MustOverride Function GetIcmpV4Statistics () As IcmpV4Statistics
傳回
一個 IcmpV4Statistics 提供本地電腦 ICMP 版本 4 流量統計資料的物件。
- 屬性
例外狀況
Win32 的功能 GetIcmpStatistics 失敗了。
範例
以下範例顯示目前的 ICMPv4 統計數據。
public static void ShowIcmpV4Statistics()
{
IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
IcmpV4Statistics stat = properties.GetIcmpV4Statistics();
Console.WriteLine("ICMP V4 Statistics:");
Console.WriteLine(" Messages ............................ Sent: {0,-10} Received: {1,-10}",
stat.MessagesSent, stat.MessagesReceived);
Console.WriteLine(" Errors .............................. Sent: {0,-10} Received: {1,-10}",
stat.ErrorsSent, stat.ErrorsReceived);
Console.WriteLine(" Echo Requests ....................... Sent: {0,-10} Received: {1,-10}",
stat.EchoRequestsSent, stat.EchoRequestsReceived);
Console.WriteLine(" Echo Replies ........................ Sent: {0,-10} Received: {1,-10}",
stat.EchoRepliesSent, stat.EchoRepliesReceived);
Console.WriteLine(" Destination Unreachables ............ Sent: {0,-10} Received: {1,-10}",
stat.DestinationUnreachableMessagesSent, stat.DestinationUnreachableMessagesReceived);
Console.WriteLine(" Source Quenches ..................... Sent: {0,-10} Received: {1,-10}",
stat.SourceQuenchesSent, stat.SourceQuenchesReceived);
Console.WriteLine(" Redirects ........................... Sent: {0,-10} Received: {1,-10}",
stat.RedirectsSent, stat.RedirectsReceived);
Console.WriteLine(" TimeExceeded ........................ Sent: {0,-10} Received: {1,-10}",
stat.TimeExceededMessagesSent, stat.TimeExceededMessagesReceived);
Console.WriteLine(" Parameter Problems .................. Sent: {0,-10} Received: {1,-10}",
stat.ParameterProblemsSent, stat.ParameterProblemsReceived);
Console.WriteLine(" Timestamp Requests .................. Sent: {0,-10} Received: {1,-10}",
stat.TimestampRequestsSent, stat.TimestampRequestsReceived);
Console.WriteLine(" Timestamp Replies ................... Sent: {0,-10} Received: {1,-10}",
stat.TimestampRepliesSent, stat.TimestampRepliesReceived);
Console.WriteLine(" Address Mask Requests ............... Sent: {0,-10} Received: {1,-10}",
stat.AddressMaskRequestsSent, stat.AddressMaskRequestsReceived);
Console.WriteLine(" Address Mask Replies ................ Sent: {0,-10} Received: {1,-10}",
stat.AddressMaskRepliesSent, stat.AddressMaskRepliesReceived);
Console.WriteLine("");
}
備註
ICMP 是一組用於網際網路協定第 4 版(IPv4)的訊息。 ICMP 被 IPv4 節點用來回報處理資料封包時遇到的錯誤,以及執行其他網際網路層的功能。 ICMP 版本 4 定義於 IETF RFC 792 中。
關於應用程式可用的 ICMP 第 4 版流量統計詳情,請參閱 IcmpV4Statistics 類別文件。 請注意, IcmpV4Statistics 此方法回傳的物件反映的是物件建立時的統計數據。 這些資訊不會動態更新。