这段代码可以将点分隔的ip地址转换成长整形数字,非常实用
public static long ConvertIPToLong(string ipAddress) { // code from http://www.75271.com System.Net.IPAddress ip; if (System.Net.IPAddress.TryParse(ipAddress, out ip)) { byte[] bytes = ip.GetAddressBytes(); return (long) ( 16777216 * (long)bytes[0] + 65536 * (long)bytes[1] + 256 * (long)bytes[2] + (long)bytes[3] ) ; } else return 0; }