IPGlobalProperties.GetIPv6GlobalStatistics Méthode

Définition

Fournit des données statistiques IPv6 (Internet Protocol version 6) pour l'ordinateur local.

public:
 abstract System::Net::NetworkInformation::IPGlobalStatistics ^ GetIPv6GlobalStatistics();
public abstract System.Net.NetworkInformation.IPGlobalStatistics GetIPv6GlobalStatistics ();
[System.Runtime.Versioning.UnsupportedOSPlatform("freebsd")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("osx")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public abstract System.Net.NetworkInformation.IPGlobalStatistics GetIPv6GlobalStatistics ();
abstract member GetIPv6GlobalStatistics : unit -> System.Net.NetworkInformation.IPGlobalStatistics
[<System.Runtime.Versioning.UnsupportedOSPlatform("freebsd")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("osx")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
abstract member GetIPv6GlobalStatistics : unit -> System.Net.NetworkInformation.IPGlobalStatistics
Public MustOverride Function GetIPv6GlobalStatistics () As IPGlobalStatistics

Retours

Objet IPGlobalStatistics qui fournit des statistiques de trafic IPv6 pour l'ordinateur local.

Attributs

Exceptions

L'appel à la fonction Win32 GetIpStatistics a échoué.

L'ordinateur local n'exécute pas un système d'exploitation qui prend en charge le protocole IPv6.

Exemples

L’exemple de code suivant affiche des statistiques IP pour l’ordinateur local.

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

Remarques

IPv6 est un protocole de couche réseau responsable du routage des paquets de données de son ordinateur source vers sa destination. Le protocole IPv6 n’est pas pris en charge sur les ordinateurs dotés de systèmes d’exploitation Windows 2000 ou antérieurs.

Pour plus d’informations sur les statistiques de trafic IP disponibles pour les applications, consultez la documentation de la IPGlobalStatistics classe. Notez que l’objet retourné par cette méthode reflète les statistiques au moment de la création de l’objet IPGlobalStatistics . Ces informations ne sont pas mises à jour dynamiquement.

S’applique à