This documentation is archived and is not being maintained.

TcpConnectionInformation Class

Provides information about the Transmission Control Protocol (TCP) connections on the local computer.

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

public abstract class TcpConnectionInformation

TCP is a connection-oriented reliable protocol for transporting data between networked computers. It is defined in IETF RFC 793.

The following example displays endpoint information for active TCP connections.

        public static void GetTcpConnections()
            IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
//            TcpConnectionInformation connections = properties.GetActiveTcpConnections();
            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);
void GetTcpConnections()
    IPGlobalProperties* properties = IPGlobalProperties::GetIPGlobalProperties();
    TcpConnection* connections[] = properties->GetActiveTcpConnections();

    System::Collections::IEnumerator* myEnum = connections->GetEnumerator();
    while (myEnum->MoveNext())
        TcpConnection* t = __try_cast<TcpConnection*>(myEnum->Current);
        Console::Write(S"Local endpoint: {0} ",t->LocalEndPoint->Address);
        Console::Write(S"Remote endpoint: {0} ",t->RemoteEndPoint->Address);
        Console::WriteLine(S"{0}", __box(t->State));


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0