Exemplo n.º 1
0
        public static EndPoint GetEndPoint()
        {
            EndPoint ep = new EndPoint();
            ep.DomainName = Environment.MachineName + "._local.";
            foreach (NetworkInterface iface in NetworkInterface.GetAllNetworkInterfaces())
            {
                if (iface.OperationalStatus == OperationalStatus.Up)
                {

                    foreach (var address in iface.GetIPProperties().UnicastAddresses)
                    {
                        if (address.Address.IsIPv6LinkLocal || System.Net.IPAddress.IsLoopback(address.Address))
                            continue;
                        ep.Addresses.Add(address.Address);
                    }
                }
            }
            return ep;
        }
Exemplo n.º 2
0
 public void AddAddress(Network.Dns.EndPoint endpoint)
 {
     addresses.Add(endpoint);
 }