Share via


IPGlobalStatistics.ReceivedPacketsWithAddressErrors 属性

定义

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

public:
 abstract property long ReceivedPacketsWithAddressErrors { long get(); };
public abstract long ReceivedPacketsWithAddressErrors { get; }
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract long ReceivedPacketsWithAddressErrors { get; }
member this.ReceivedPacketsWithAddressErrors : int64
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
member this.ReceivedPacketsWithAddressErrors : int64
Public MustOverride ReadOnly Property ReceivedPacketsWithAddressErrors As Long

属性值

Int64 值,它指定收到的、标头的地址部分有错误的 IP 数据包的总数。

属性

示例

下面的代码示例显示包含错误的已接收 IP 数据包的统计信息。

void ShowInboundIPErrors()
{
   IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties();
   IPGlobalStatistics ^ ipstat = properties->GetIPv4GlobalStatistics();
   Console::WriteLine( "  Inbound Packet Errors:" );
   Console::WriteLine( "      Header Errors ....................... : {0}", 
      ipstat->ReceivedPacketsWithHeadersErrors );
   Console::WriteLine( "      Address Errors ...................... : {0}", 
      ipstat->ReceivedPacketsWithAddressErrors );
   Console::WriteLine( "      Unknown Protocol Errors ............. : {0}", 
      ipstat->ReceivedPacketsWithUnknownProtocol );
}

public static void ShowInboundIPErrors()
{
    IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
    IPGlobalStatistics ipstat = properties.GetIPv4GlobalStatistics();
    Console.WriteLine("  Inbound Packet Errors:");
    Console.WriteLine("      Header Errors ....................... : {0}",
        ipstat.ReceivedPacketsWithHeadersErrors);
    Console.WriteLine("      Address Errors ...................... : {0}",
        ipstat.ReceivedPacketsWithAddressErrors);
    Console.WriteLine("      Unknown Protocol Errors ............. : {0}",
        ipstat.ReceivedPacketsWithUnknownProtocol);
}
Public Shared Sub ShowInboundIPErrors() 
    Dim properties As IPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties()
    Dim ipstat As IPGlobalStatistics = properties.GetIPv4GlobalStatistics()
    Console.WriteLine("  Inbound Packet Errors:")
    Console.WriteLine("      Header Errors ....................... : {0}", ipstat.ReceivedPacketsWithHeadersErrors)
    Console.WriteLine("      Address Errors ...................... : {0}", ipstat.ReceivedPacketsWithAddressErrors)
    Console.WriteLine("      Unknown Protocol Errors ............. : {0}", ipstat.ReceivedPacketsWithUnknownProtocol)

End Sub

注解

此属性返回的值包括标头字段中与地址相关的问题(例如无效地址)丢弃的数据包。 如果未启用数据包转发,则此属性返回的值包括由于目标地址不是本地地址而丢弃的数据包。

适用于