public partial class Form1 : Form{ public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { //Retriving IP global properties IPGlobalProperties IPGproperties = IPGlobalProperties.GetIPGlobalProperties(); //Retriving the TCP connections TcpConnectionInformation[] connections = IPGproperties.GetActiveTcpConnections(); foreach (TcpConnectionInformation tcp in connections) { //Displaying TCP connection informations StringBuilder sb = new StringBuilder(); sb.Append("Local endpoint:\t"+tcp.LocalEndPoint.Address.ToString()); sb.Append("\nRemote endpoint:\t"+ tcp.RemoteEndPoint.Address.ToString()); sb.Append("\nState:\t\t"+ tcp.State.ToString()); MessageBox.Show(sb.ToString(),"TCP connection status"); } }}