TcpConnectionInformation.LocalEndPoint Propriété
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.
Obtient le point de terminaison local d’une connexion TCP.
public:
abstract property System::Net::IPEndPoint ^ LocalEndPoint { System::Net::IPEndPoint ^ get(); };
public abstract System.Net.IPEndPoint LocalEndPoint { get; }
member this.LocalEndPoint : System.Net.IPEndPoint
Public MustOverride ReadOnly Property LocalEndPoint As IPEndPoint
Valeur de propriété
Instance IPEndPoint qui contient l'adresse IP et le port sur l'ordinateur local.
Exemples
L’exemple suivant affiche des informations de point de terminaison pour les connexions TCP actives.
void GetTcpConnections()
{
IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties();
array<TcpConnectionInformation^>^connections = properties->GetActiveTcpConnections();
System::Collections::IEnumerator^ myEnum = connections->GetEnumerator();
while ( myEnum->MoveNext() )
{
TcpConnectionInformation ^ t = safe_cast<TcpConnectionInformation ^>(myEnum->Current);
Console::Write( "Local endpoint: {0} ", t->LocalEndPoint->Address );
Console::Write( "Remote endpoint: {0} ", t->RemoteEndPoint->Address );
Console::WriteLine( "{0}", t->State );
}
}
public static void GetTcpConnections()
{
IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
TcpConnectionInformation[] connections = properties.GetActiveTcpConnections();
foreach (TcpConnectionInformation t in connections)
{
Console.Write("Local endpoint: {0} ",t.LocalEndPoint.Address);
Console.Write("Remote endpoint: {0} ",t.RemoteEndPoint.Address);
Console.WriteLine("{0}",t.State);
}
Console.WriteLine();
}
Public Shared Sub GetTcpConnections()
Dim properties As IPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties()
Dim connections As TcpConnectionInformation() = properties.GetActiveTcpConnections()
Dim t As TcpConnectionInformation
For Each t In connections
Console.Write("Local endpoint: {0} ", t.LocalEndPoint.Address)
Console.Write("Remote endpoint: {0} ", t.RemoteEndPoint.Address)
Console.WriteLine("{0}", t.State)
Next t
End Sub
S’applique à
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour