using System.Net; using System.Net.Sockets; using System.Net.NetworkInformation; IPGlobalProperties ipProperties = IPGlobalProperties.GetIPGlobalProperties(); IPEndPoint[] ipEndPoints = ipProperties.GetActiveTcpListeners(); foreach (var item in ipEndPoints) { }