Example #1
0
 public static IEndPoint[] Get(IEndPoint ep)
 {
     var name = ep.ToString();
     if (name == Environment.MachineName || name == "localhost" || name == "127.0.0.1")
         return new[] { Environment.MachineName, "localhost", "127.0.0.1" }
             .Select(n => new Cls.Connections.EndPoint(n)).ToArray();
     var addresses = Dns.GetHostAddresses(name);
     return Enumerable.Repeat(ep, 1).Concat(
         addresses.Where(n => n.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
             .Select(n => new Cls.Connections.EndPoint(n.ToString())))
             .ToArray();
 }