public void IsValidNetworkFound() { isFound = false; foreach (IPAddress IPA in Dns.GetHostAddresses(Dns.GetHostName())) { if (IPA.AddressFamily == AddressFamily.InterNetwork) { byte[] data = IPA.GetAddressBytes(); // Split string by ".", check that array length is 3 if (data[0] == 192 && data[1] == 168 && data[2] == 1) { if (data[3] < 255 && data[3] > 1) { isFound = true; break; } } } } }