TcpConnectionInformation::LocalEndPoint Property

 

Gets the local endpoint of a Transmission Control Protocol (TCP) connection.

Namespace:   System.Net.NetworkInformation
Assembly:  System (in System.dll)

public:
property IPEndPoint^ LocalEndPoint {
	virtual IPEndPoint^ get() abstract;
}

Property Value

Type: System.Net::IPEndPoint^

An IPEndPoint instance that contains the IP address and port on the local computer.

The following example displays endpoint information for active TCP connections.

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

.NET Framework
Available since 2.0
Return to top
Show: