共用方式為


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("");
}

備註

GetTcpIPv6Statistics 方法會傳GetTcpIPv4Statistics回這個類別的實例,讓應用程式能夠存取 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)

適用於