LocalEndPoint Property
Collapse the table of content
Expand the table of content

TcpConnectionInformation.LocalEndPoint Property

 

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

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

public abstract IPEndPoint LocalEndPoint { get; }

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.

        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);
                Console.WriteLine("{0}",t.State);
            }
            Console.WriteLine();
        }

.NET Framework
Available since 2.0
Return to top
Show:
© 2016 Microsoft