IPGlobalProperties.GetActiveTcpListeners Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Retourne des informations sur les points de terminaison des écouteurs TCP (Transmission Control Protocol) IPv4 (Internet Protocol version 4) et IPv6 sur l'ordinateur local.
public:
abstract cli::array <System::Net::IPEndPoint ^> ^ GetActiveTcpListeners();
public abstract System.Net.IPEndPoint[] GetActiveTcpListeners ();
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract System.Net.IPEndPoint[] GetActiveTcpListeners ();
abstract member GetActiveTcpListeners : unit -> System.Net.IPEndPoint[]
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
abstract member GetActiveTcpListeners : unit -> System.Net.IPEndPoint[]
Public MustOverride Function GetActiveTcpListeners () As IPEndPoint()
Retours
Tableau IPEndPoint qui contient des objets qui décrivent les écouteurs TCP actifs ou tableau vide si aucun écouteur TCP actif n'est détecté.
- Attributs
Exceptions
La fonction Win32 GetTcpTable
a échoué.
Exemples
L’exemple de code suivant affiche les informations de point de terminaison pour les écouteurs TCP actifs.
void ShowActiveTcpListeners()
{
Console::WriteLine( "Active TCP Listeners" );
IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties();
array<IPEndPoint^>^endPoints = properties->GetActiveTcpListeners();
System::Collections::IEnumerator^ myEnum7 = endPoints->GetEnumerator();
while ( myEnum7->MoveNext() )
{
IPEndPoint^ e = safe_cast<IPEndPoint^>(myEnum7->Current);
Console::WriteLine( e );
}
}
public static void ShowActiveTcpListeners()
{
Console.WriteLine("Active TCP Listeners");
IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
IPEndPoint[] endPoints = properties.GetActiveTcpListeners();
foreach (IPEndPoint e in endPoints)
{
Console.WriteLine(e.ToString());
}
}
Remarques
Les objets retournés par cette méthode incluent des écouteurs dans tous les états TCP, à l’exception de l’état Listen .
Le protocole TCP est défini dans IETF RFC 793. Notez que les objets retournés par cette méthode reflètent les connexions au moment de la création du tableau. Ces informations ne sont pas mises à jour dynamiquement.
S’applique à
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de l’année 2024, nous abandonnerons progressivement le mécanisme de retour d’information GitHub Issues pour le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultez :Soumettre et afficher des commentaires pour