internal static IList <IPEndPoint> GetEndPoints(Server server, IPBinding binding) { if (!binding.Address.Equals(IPAddress.Any) && !binding.Address.Equals(IPAddress.IPv6Any)) { return(new IPEndPoint[] { binding }); } ManagementPath path = new ManagementPath(string.Format("\\\\{0}\\root\\cimv2", server.Fqdn)); System.Management.ManagementScope scope = new System.Management.ManagementScope(path); IList <NetworkConnectionInfo> connectionInfo = NetworkConnectionInfo.GetConnectionInfo(scope); List <IPEndPoint> list = new List <IPEndPoint>(); foreach (NetworkConnectionInfo networkConnectionInfo in connectionInfo) { foreach (IPAddress address in networkConnectionInfo.IPAddresses) { list.Add(new IPEndPoint(address, binding.Port)); } } return(list); }