다음을 통해 공유


IPGlobalProperties.GetTcpIPv4Statistics 메서드

정의

로컬 컴퓨터에 대한 TCP/IPv4 통계 데이터를 제공합니다.

public:
 abstract System::Net::NetworkInformation::TcpStatistics ^ GetTcpIPv4Statistics();
public abstract System.Net.NetworkInformation.TcpStatistics GetTcpIPv4Statistics ();
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract System.Net.NetworkInformation.TcpStatistics GetTcpIPv4Statistics ();
abstract member GetTcpIPv4Statistics : unit -> System.Net.NetworkInformation.TcpStatistics
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
abstract member GetTcpIPv4Statistics : unit -> System.Net.NetworkInformation.TcpStatistics
Public MustOverride Function GetTcpIPv4Statistics () As TcpStatistics

반환

로컬 컴퓨터에 대한 TCP/IPv4 트래픽 통계를 제공하는 TcpStatistics 개체입니다.

특성

예외

Win32 함수 GetTcpStatistics에 대한 호출에 실패한 경우

예제

다음 예제에서는 로컬 컴퓨터에 대한 TCP/IP 통계를 표시합니다.

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

설명

TCP는 데이터 패킷을 안정적으로 보내고 받는 전송 계층 프로토콜입니다. IETF RFC 793에 정의되어 있습니다.

애플리케이션에 제공 되는 TCP 트래픽 통계에 대 한 내용은 참조는 TcpStatistics 클래스 설명서. 이 메서드에서 반환된 개체는 개체가 만들어진 시점의 통계를 TcpStatistics 반영합니다. 이 정보는 동적으로 업데이트되지 않습니다.

적용 대상