TcpStatistics 类

定义

提供传输控制协议 (TCP) 统计数据。

public ref class TcpStatistics abstract
public abstract class TcpStatistics
type TcpStatistics = class
Public MustInherit Class TcpStatistics
继承
TcpStatistics

示例

下面的代码示例显示指定地址系列的 TCP 统计信息。

void ShowTcpStatistics( NetworkInterfaceComponent version )
{
   IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties();
   TcpStatistics ^ tcpstat = nullptr;
   Console::WriteLine( "" );
   switch ( version )
   {
      case NetworkInterfaceComponent::IPv4:
         tcpstat = properties->GetTcpIPv4Statistics();
         Console::WriteLine( "TCP/IPv4 Statistics:" );
         break;

      case NetworkInterfaceComponent::IPv6:
         tcpstat = properties->GetTcpIPv6Statistics();
         Console::WriteLine( "TCP/IPv6 Statistics:" );
         break;

      default:
         throw gcnew ArgumentException( "version" );
         break;
   }
   Console::WriteLine( "  Minimum Transmission Timeout............. : {0}",
      tcpstat->MinimumTransmissionTimeout );
   Console::WriteLine( "  Maximum Transmission Timeout............. : {0}",
      tcpstat->MaximumTransmissionTimeout );
   Console::WriteLine( "  Connection Data:" );
   Console::WriteLine( "      Current  ............................ : {0}",
      tcpstat->CurrentConnections );
   Console::WriteLine( "      Cumulative .......................... : {0}",
      tcpstat->CumulativeConnections );
   Console::WriteLine( "      Initiated ........................... : {0}",
      tcpstat->ConnectionsInitiated );
   Console::WriteLine( "      Accepted ............................ : {0}",
      tcpstat->ConnectionsAccepted );
   Console::WriteLine( "      Failed Attempts ..................... : {0}",
      tcpstat->FailedConnectionAttempts );
   Console::WriteLine( "      Reset ............................... : {0}",
      tcpstat->ResetConnections );
   Console::WriteLine( "" );
   Console::WriteLine( "  Segment Data:" );
   Console::WriteLine( "      Received  ........................... : {0}",
      tcpstat->SegmentsReceived );
   Console::WriteLine( "      Sent ................................ : {0}",
      tcpstat->SegmentsSent );
   Console::WriteLine( "      Retransmitted ....................... : {0}",
      tcpstat->SegmentsResent );
   Console::WriteLine( "" );
}
public static void ShowTcpStatistics(NetworkInterfaceComponent version)
{
    IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
    TcpStatistics tcpstat = null;
    Console.WriteLine("");
    switch (version)
    {
        case NetworkInterfaceComponent.IPv4:
             tcpstat = properties.GetTcpIPv4Statistics();
            Console.WriteLine("TCP/IPv4 Statistics:");
            break;
        case NetworkInterfaceComponent.IPv6:
            tcpstat = properties.GetTcpIPv6Statistics();
            Console.WriteLine("TCP/IPv6 Statistics:");
            break;
        default:
            throw new ArgumentException("version");
        //    break;
    }
    Console.WriteLine("  Minimum Transmission Timeout............. : {0}",
        tcpstat.MinimumTransmissionTimeout);
    Console.WriteLine("  Maximum Transmission Timeout............. : {0}",
        tcpstat.MaximumTransmissionTimeout);

    Console.WriteLine("  Connection Data:");
    Console.WriteLine("      Current  ............................ : {0}",
    tcpstat.CurrentConnections);
    Console.WriteLine("      Cumulative .......................... : {0}",
        tcpstat.CumulativeConnections);
    Console.WriteLine("      Initiated ........................... : {0}",
        tcpstat.ConnectionsInitiated);
    Console.WriteLine("      Accepted ............................ : {0}",
        tcpstat.ConnectionsAccepted);
    Console.WriteLine("      Failed Attempts ..................... : {0}",
        tcpstat.FailedConnectionAttempts);
    Console.WriteLine("      Reset ............................... : {0}",
        tcpstat.ResetConnections);

    Console.WriteLine("");
    Console.WriteLine("  Segment Data:");
    Console.WriteLine("      Received  ........................... : {0}",
        tcpstat.SegmentsReceived);
    Console.WriteLine("      Sent ................................ : {0}",
        tcpstat.SegmentsSent);
    Console.WriteLine("      Retransmitted ....................... : {0}",
        tcpstat.SegmentsResent);

    Console.WriteLine("");
}

注解

此类的实例由 GetTcpIPv4StatisticsGetTcpIPv6Statistics 方法返回,使应用程序能够访问 TCP 流量信息。

此类中的信息与 中所述 https://www.ietf.org/rfc/rfc2012.txt的管理信息对象相关联。

构造函数

TcpStatistics()

初始化 TcpStatistics 类的新实例。

属性

ConnectionsAccepted

获取接受的传输控制协议 (TCP) 连接请求数。

ConnectionsInitiated

获取由客户端发出的传输控制协议 (TCP) 连接请求数。

CumulativeConnections

指定建立的传输控制协议 (TCP) 连接的总数。

CurrentConnections

获取当前传输控制协议 (TCP) 连接数。

ErrorsReceived

获取收到的传输控制协议 (TCP) 错误数。

FailedConnectionAttempts

获取失败的传输控制协议 (TCP) 连接尝试数。

MaximumConnections

获取支持的传输控制协议 (TCP) 连接的最大数。

MaximumTransmissionTimeout

获取传输控制协议 (TCP) 段的最大重新传输超时值。

MinimumTransmissionTimeout

获取传输控制协议 (TCP) 段的最小重新传输超时值。

ResetConnections

获取传输控制协议 (TCP) 连接收到的 RST 数据包数。

ResetsSent

获取发送时设置了重置标志的传输控制协议 (TCP) 段数。

SegmentsReceived

获取收到的传输控制协议 (TCP) 段数。

SegmentsResent

获取重新发送的传输控制协议 (TCP) 段数。

SegmentsSent

获取发送的传输控制协议 (TCP) 段数。

方法

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
ToString()

返回表示当前对象的字符串。

(继承自 Object)

适用于