public static long IPToLong(string strIP) { byte[] array = new byte[8]; string[] array2 = strIP.Split(new char[] { '.' }); for (int i = 0; i < 4; i++) { array[i] = byte.Parse(array2[3 - i]); } return BitConverter.ToInt64(array, 0); }