IPGlobalProperties.GetIPv4GlobalStatistics 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
로컬 컴퓨터에 대한 IPv4(인터넷 프로토콜 버전 4) 통계 데이터를 제공합니다.
public:
abstract System::Net::NetworkInformation::IPGlobalStatistics ^ GetIPv4GlobalStatistics();
public abstract System.Net.NetworkInformation.IPGlobalStatistics GetIPv4GlobalStatistics ();
abstract member GetIPv4GlobalStatistics : unit -> System.Net.NetworkInformation.IPGlobalStatistics
Public MustOverride Function GetIPv4GlobalStatistics () As IPGlobalStatistics
반환
로컬 컴퓨터에 대한 IPv4 트래픽 통계를 제공하는 IPGlobalStatistics 개체입니다.
예외
Win32 함수 GetIpStatistics
에 대한 호출에 실패한 경우
예제
다음 코드 예제에서는 로컬 컴퓨터에 대 한 IP 통계를 표시 합니다.
void ShowIPStatistics( NetworkInterfaceComponent version )
{
IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties();
IPGlobalStatistics ^ ipstat = nullptr;
switch ( version )
{
case NetworkInterfaceComponent::IPv4:
ipstat = properties->GetIPv4GlobalStatistics();
Console::WriteLine( "{0}IPv4 Statistics ", Environment::NewLine );
break;
case NetworkInterfaceComponent::IPv6:
ipstat = properties->GetIPv4GlobalStatistics();
Console::WriteLine( "{0}IPv6 Statistics ", Environment::NewLine );
break;
default:
throw gcnew ArgumentException( "version" );
break;
}
Console::WriteLine( " Forwarding enabled ...................... : {0}",
ipstat->ForwardingEnabled );
Console::WriteLine( " Interfaces .............................. : {0}",
ipstat->NumberOfInterfaces );
Console::WriteLine( " IP addresses ............................ : {0}",
ipstat->NumberOfIPAddresses );
Console::WriteLine( " Routes .................................. : {0}",
ipstat->NumberOfRoutes );
Console::WriteLine( " Default TTL ............................. : {0}",
ipstat->DefaultTtl );
Console::WriteLine( "" );
Console::WriteLine( " Inbound Packet Data:" );
Console::WriteLine( " Received ............................ : {0}",
ipstat->ReceivedPackets );
Console::WriteLine( " Forwarded ........................... : {0}",
ipstat->ReceivedPacketsForwarded );
Console::WriteLine( " Delivered ........................... : {0}",
ipstat->ReceivedPacketsDelivered );
Console::WriteLine( " Discarded ........................... : {0}",
ipstat->ReceivedPacketsDiscarded );
Console::WriteLine( " Header Errors ....................... : {0}",
ipstat->ReceivedPacketsWithHeadersErrors );
Console::WriteLine( " Address Errors ...................... : {0}",
ipstat->ReceivedPacketsWithAddressErrors );
Console::WriteLine( " Unknown Protocol Errors ............. : {0}",
ipstat->ReceivedPacketsWithUnknownProtocol );
Console::WriteLine( "" );
Console::WriteLine( " Outbound Packet Data:" );
Console::WriteLine( " Requested ........................... : {0}",
ipstat->OutputPacketRequests );
Console::WriteLine( " Discarded ........................... : {0}",
ipstat->OutputPacketsDiscarded );
Console::WriteLine( " No Routing Discards ................. : {0}",
ipstat->OutputPacketsWithNoRoute );
Console::WriteLine( " Routing Entry Discards .............. : {0}",
ipstat->OutputPacketRoutingDiscards );
Console::WriteLine( "" );
Console::WriteLine( " Reassembly Data:" );
Console::WriteLine( " Reassembly Timeout .................. : {0}",
ipstat->PacketReassemblyTimeout );
Console::WriteLine( " Reassemblies Required ............... : {0}",
ipstat->PacketReassembliesRequired );
Console::WriteLine( " Packets Reassembled ................. : {0}",
ipstat->PacketsReassembled );
Console::WriteLine( " Packets Fragmented .................. : {0}",
ipstat->PacketsFragmented );
Console::WriteLine( " Fragment Failures ................... : {0}",
ipstat->PacketFragmentFailures );
Console::WriteLine( "" );
}
public static void ShowIPStatistics(NetworkInterfaceComponent version)
{
IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
IPGlobalStatistics ipstat = null;
switch (version)
{
case NetworkInterfaceComponent.IPv4:
ipstat = properties.GetIPv4GlobalStatistics();
Console.WriteLine("{0}IPv4 Statistics ",Environment.NewLine);
break;
case NetworkInterfaceComponent.IPv6:
ipstat = properties.GetIPv6GlobalStatistics();
Console.WriteLine("{0}IPv6 Statistics ",Environment.NewLine);
break;
default:
throw new ArgumentException("version");
// break;
}
Console.WriteLine(" Forwarding enabled ...................... : {0}",
ipstat.ForwardingEnabled);
Console.WriteLine(" Interfaces .............................. : {0}",
ipstat.NumberOfInterfaces);
Console.WriteLine(" IP addresses ............................ : {0}",
ipstat.NumberOfIPAddresses);
Console.WriteLine(" Routes .................................. : {0}",
ipstat.NumberOfRoutes);
Console.WriteLine(" Default TTL ............................. : {0}",
ipstat.DefaultTtl);
Console.WriteLine("");
Console.WriteLine(" Inbound Packet Data:");
Console.WriteLine(" Received ............................ : {0}",
ipstat.ReceivedPackets);
Console.WriteLine(" Forwarded ........................... : {0}",
ipstat.ReceivedPacketsForwarded);
Console.WriteLine(" Delivered ........................... : {0}",
ipstat.ReceivedPacketsDelivered);
Console.WriteLine(" Discarded ........................... : {0}",
ipstat.ReceivedPacketsDiscarded);
Console.WriteLine(" Header Errors ....................... : {0}",
ipstat.ReceivedPacketsWithHeadersErrors);
Console.WriteLine(" Address Errors ...................... : {0}",
ipstat.ReceivedPacketsWithAddressErrors);
Console.WriteLine(" Unknown Protocol Errors ............. : {0}",
ipstat.ReceivedPacketsWithUnknownProtocol);
Console.WriteLine("");
Console.WriteLine(" Outbound Packet Data:");
Console.WriteLine(" Requested ........................... : {0}",
ipstat.OutputPacketRequests);
Console.WriteLine(" Discarded ........................... : {0}",
ipstat.OutputPacketsDiscarded);
Console.WriteLine(" No Routing Discards ................. : {0}",
ipstat.OutputPacketsWithNoRoute);
Console.WriteLine(" Routing Entry Discards .............. : {0}",
ipstat.OutputPacketRoutingDiscards);
Console.WriteLine("");
Console.WriteLine(" Reassembly Data:");
Console.WriteLine(" Reassembly Timeout .................. : {0}",
ipstat.PacketReassemblyTimeout);
Console.WriteLine(" Reassemblies Required ............... : {0}",
ipstat.PacketReassembliesRequired);
Console.WriteLine(" Packets Reassembled ................. : {0}",
ipstat.PacketsReassembled);
Console.WriteLine(" Packets Fragmented .................. : {0}",
ipstat.PacketsFragmented);
Console.WriteLine(" Fragment Failures ................... : {0}",
ipstat.PacketFragmentFailures);
Console.WriteLine("");
}
설명
IPv4는 원본 컴퓨터에서 대상으로 데이터 패킷을 라우팅하는 네트워크 계층 프로토콜입니다.
애플리케이션에서 사용할 IP 트래픽 통계에 대 한 내용은 참조는 IPGlobalStatistics 클래스 설명서. 이 메서드에서 반환된 개체는 개체가 만들어진 시점의 통계를 IPGlobalStatistics 반영합니다. 이 정보는 동적으로 업데이트되지 않습니다.
적용 대상
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET