Beispiel #1
0
        public static List <string> ReturnDNSServers()
        {
            List <string> dnsServerAddresses = new List <string>();

            foreach (WlanClient.WlanInterface wlanInterface in Networking.client.Interfaces)
            {
                foreach (var dnsAddr in wlanInterface.NetworkInterface.GetIPProperties().DnsAddresses)
                {
                    if (Networking.IsConnected() == false)
                    {
                        dnsServerAddresses.Add(SocketError.NotConnected.ToString());
                    }
                    else
                    {
                        dnsServerAddresses.Add(dnsAddr.ToString());
                    }
                }
            }
            return(dnsServerAddresses);
        }
Beispiel #2
0
        public static string ReturnCurrentIPv4()
        {
            string ipv4Address = string.Empty;

            foreach (WlanClient.WlanInterface wlanInterface in Networking.client.Interfaces)
            {
                foreach (var ipAddr in wlanInterface.NetworkInterface.GetIPProperties().UnicastAddresses)
                {
                    if (ipAddr.Address.AddressFamily == AddressFamily.InterNetwork && Networking.IsConnected() == true)
                    {
                        ipv4Address = ipAddr.Address.ToString();
                    }
                    else
                    {
                        ipv4Address = SocketError.NotConnected.ToString();
                    }
                }
            }

            return(ipv4Address);
        }
Beispiel #3
0
        public static string ReturnCurrentGateway()
        {
            string gateway = string.Empty;

            foreach (WlanClient.WlanInterface wlanInterface in Networking.client.Interfaces)
            {
                foreach (var ipAddr in wlanInterface.NetworkInterface.GetIPProperties().GatewayAddresses)
                {
                    if (ipAddr.Address.AddressFamily == AddressFamily.InterNetwork && Networking.IsConnected() == true)
                    {
                        gateway = ipAddr.Address.ToString();
                    }
                    else
                    {
                        gateway = SocketError.NotConnected.ToString();
                    }
                }
            }
            return(gateway);
        }