private void get_netinfo() { // internet connection Client.NetConnect.isValid = canConnect("www.google.be"); Client.NetConnect.Set(Client.NetConnect.isValid == true ? "ja" : "nee"); // domain connection Client.DomainName.Set(getDomain() == null ? "nee" : getDomain()); Client.DcConnect.Set(canConnect(Client.LogonServer.text + "." + Client.DomainName.text) == true ? "ja" : "nee"); Client.Ip.Clear(); if (Client.NetConnect.isValid == true) { if (Client.ClientName.text != Client.ComputerName.text) { Client.ComputerName.Key = "server"; // client is a terminal try { int i = 1; IPAddress[] localIPs = Dns.GetHostAddresses(Client.ClientName.text); foreach (IPAddress ip in localIPs) { if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { Dict ipaddress = new Dict("Ip Adres"); ipaddress.text = ip.ToString(); ipaddress.Key = "Ip #" + i.ToString(); i++; // bereken hier interface naam // tot hier Client.Ip.Add(ipaddress); } } } catch (System.Net.Sockets.SocketException) { } } else { // client is a computer try { IPAddress[] localIPs = Dns.GetHostAddresses(Dns.GetHostName()); foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces()) if (ni.OperationalStatus == OperationalStatus.Up && ni.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 || ni.NetworkInterfaceType == NetworkInterfaceType.Ethernet) foreach (UnicastIPAddressInformation ip in ni.GetIPProperties().UnicastAddresses) if (ip.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) if (!ip.Address.ToString().StartsWith("169.254.")) { Dict ipaddress = new Dict(("IP " + ni.Name.Split(' ')[0]).Trim()); ipaddress.text = ip.Address.ToString(); Client.Ip.Add(ipaddress); } } catch (System.Net.Sockets.SocketException) { } } } }
private void get_netinfo() { // internet connection Client.NetConnect.isValid = canConnect("www.google.be"); Client.NetConnect.Set(Client.NetConnect.isValid == true ? "ja" : "nee"); // domain connection Client.DomainName.Set(getDomain() == null ? "nee" : getDomain()); Client.DcConnect.Set(canConnect(Client.LogonServer.text + "." + Client.DomainName.text) == true ? "ja" : "nee"); Client.Ip.Clear(); if (Client.NetConnect.isValid == true) { if (Client.ClientName.text != Client.ComputerName.text) { Client.ComputerName.Key = "server"; // client is a terminal try { int i = 1; IPAddress[] localIPs = Dns.GetHostAddresses(Client.ClientName.text); foreach (IPAddress ip in localIPs) { if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { Dict ipaddress = new Dict("Ip Adres"); ipaddress.text = ip.ToString(); ipaddress.Key = "Ip #" + i.ToString(); i++; // bereken hier interface naam // tot hier Client.Ip.Add(ipaddress); } } } catch (System.Net.Sockets.SocketException) { } } else { // client is a computer try { IPAddress[] localIPs = Dns.GetHostAddresses(Dns.GetHostName()); foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces()) { if (ni.OperationalStatus == OperationalStatus.Up && ni.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 || ni.NetworkInterfaceType == NetworkInterfaceType.Ethernet) { foreach (UnicastIPAddressInformation ip in ni.GetIPProperties().UnicastAddresses) { if (ip.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { if (!ip.Address.ToString().StartsWith("169.254.")) { Dict ipaddress = new Dict(("IP " + ni.Name.Split(' ')[0]).Trim()); ipaddress.text = ip.Address.ToString(); Client.Ip.Add(ipaddress); } } } } } } catch (System.Net.Sockets.SocketException) { } } } }