UdpStatistics 类
定义
提供用户数据报协议 (UDP) 统计数据。Provides User Datagram Protocol (UDP) statistical data.
public ref class UdpStatistics abstract
public abstract class UdpStatistics
type UdpStatistics = class
Public MustInherit Class UdpStatistics
- 继承
-
UdpStatistics
示例
下面的代码示例显示指定地址族的 UDP 统计信息。The following code example displays the UDP statistics for the specified address family.
void ShowUdpStatistics( NetworkInterfaceComponent version )
{
IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties();
UdpStatistics ^ udpStat = nullptr;
switch ( version )
{
case NetworkInterfaceComponent::IPv4:
udpStat = properties->GetUdpIPv4Statistics();
Console::WriteLine( "UDP IPv4 Statistics" );
break;
case NetworkInterfaceComponent::IPv6:
udpStat = properties->GetUdpIPv6Statistics();
Console::WriteLine( "UDP IPv6 Statistics" );
break;
default:
throw gcnew ArgumentException( "version" );
break;
}
Console::WriteLine( " Datagrams Received ...................... : {0}", udpStat->DatagramsReceived );
Console::WriteLine( " Datagrams Sent .......................... : {0}", udpStat->DatagramsSent );
Console::WriteLine( " Incoming Datagrams Discarded ............ : {0}", udpStat->IncomingDatagramsDiscarded );
Console::WriteLine( " Incoming Datagrams With Errors .......... : {0}", udpStat->IncomingDatagramsWithErrors );
Console::WriteLine( " UDP Listeners ........................... : {0}", udpStat->UdpListeners );
Console::WriteLine( "" );
}
public static void ShowUdpStatistics(NetworkInterfaceComponent version)
{
IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
UdpStatistics udpStat = null;
switch (version)
{
case NetworkInterfaceComponent.IPv4:
udpStat = properties.GetUdpIPv4Statistics();
Console.WriteLine("UDP IPv4 Statistics");
break;
case NetworkInterfaceComponent.IPv6:
udpStat = properties.GetUdpIPv6Statistics();
Console.WriteLine("UDP IPv6 Statistics");
break;
default:
throw new ArgumentException("version");
// break;
}
Console.WriteLine(" Datagrams Received ...................... : {0}",
udpStat.DatagramsReceived);
Console.WriteLine(" Datagrams Sent .......................... : {0}",
udpStat.DatagramsSent);
Console.WriteLine(" Incoming Datagrams Discarded ............ : {0}",
udpStat.IncomingDatagramsDiscarded);
Console.WriteLine(" Incoming Datagrams With Errors .......... : {0}",
udpStat.IncomingDatagramsWithErrors);
Console.WriteLine(" UDP Listeners ........................... : {0}",
udpStat.UdpListeners);
Console.WriteLine("");
}
注解
此类的实例由 GetUdpIPv4Statistics 和方法返回, GetUdpIPv6Statistics 以使应用程序能够访问 UDP 流量信息。Instances of this class are returned by the GetUdpIPv4Statistics and GetUdpIPv6Statistics methods to give applications access to UDP traffic information.
此类中的信息与中所述的管理信息对象相关联 https://www.ietf.org/rfc/rfc2013.txt 。The information in this class correlates to the management information objects described in https://www.ietf.org/rfc/rfc2013.txt.
构造函数
| UdpStatistics() |
初始化 UdpStatistics 类的新实例。Initializes a new instance of the UdpStatistics class. |
属性
| DatagramsReceived |
获取已接收的用户数据报协议 (UDP) 数据报的数量。Gets the number of User Datagram Protocol (UDP) datagrams that were received. |
| DatagramsSent |
获取已发送的用户数据报协议 (UDP) 数据报的数量。Gets the number of User Datagram Protocol (UDP) datagrams that were sent. |
| IncomingDatagramsDiscarded |
获取已收到但因端口错误而放弃的用户数据报协议 (UDP) 数据报的数量。Gets the number of User Datagram Protocol (UDP) datagrams that were received and discarded because of port errors. |
| IncomingDatagramsWithErrors |
获取已收到但因错误端口信息以外的错误而放弃的用户数据报协议 (UDP) 数据报的数量。Gets the number of User Datagram Protocol (UDP) datagrams that were received and discarded because of errors other than bad port information. |
| UdpListeners |
获取侦听用户数据报协议 (UDP) 数据报的本地终结点的数量。Gets the number of local endpoints that are listening for User Datagram Protocol (UDP) datagrams. |
方法
| Equals(Object) |
确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object. (继承自 Object) |
| GetHashCode() |
作为默认哈希函数。Serves as the default hash function. (继承自 Object) |
| GetType() |
获取当前实例的 Type。Gets the Type of the current instance. (继承自 Object) |
| MemberwiseClone() |
创建当前 Object 的浅表副本。Creates a shallow copy of the current Object. (继承自 Object) |
| ToString() |
返回表示当前对象的字符串。Returns a string that represents the current object. (继承自 Object) |