import com.handsome.ip.IPSeeker;
/**
* @author shiyz
* @creation date 2012-10-24 下午3:48:25
*
*/
public class Test{
public static void main(String[] args) {
System.out.println(getIpLoaction("220.234.244.5"));
}
public static String getIpLoaction(String ip){
String ipFile="QQWry.Dat";
String ipPath="E://";
IPSeeker ips=new IPSeeker(ipFile,ipPath);
//获得地区
String address = ips.getIPLocation(ip).getCountry();
String area = ips.getIPLocation(ip).getArea();
return address + " " + area;
}
}
http://download.youkuaiyun.com/download/shiyuezhong/4683674
本文介绍了一种使用Java进行IP地址地理位置定位的方法。通过解析QQWry.Dat文件,可以获取到指定IP地址对应的国家和地区信息。代码示例展示了如何初始化IPSeeker类并调用其方法来获取地理位置。
2648

被折叠的 条评论
为什么被折叠?



