UdpStatistics.DatagramsReceived 속성

정의

받은 UDP(User Datagram Protocol) 데이터그램의 수를 가져옵니다.

public:
 abstract property long DatagramsReceived { long get(); };
public abstract long DatagramsReceived { get; }
member this.DatagramsReceived : int64
Public MustOverride ReadOnly Property DatagramsReceived As Long

속성 값

UPD 사용자에게 전달된 데이터그램의 총 수를 나타내는 Int64 값입니다.

예제

다음 코드 예제에서는 지정된 주소 패밀리에 대한 UDP 통계를 표시합니다.

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

설명

이 속성에서 반환된 숫자에는 수신되었지만 결과물이 아닌 데이터그램이 포함되지 않습니다.

적용 대상