问题描述
因此,我在之前的问题中被告知,我可以使用由MaxMind提供的确定位置。所以,我从他们的网站上下载了他们的数据库。它们是 csv
文件并在Excel中打开。
InetAddress ip = InetAddress.getLocalHost()
是我如何获得计算机的IP。从那里我做 String justIP = ip.getHostAddress()
我的问题是:
justIP
解析到城市位置? 我对此感到陌生,因此希望能有一点帮助。
其中一个文件有三列。 startIPNum
, endIPNum
和 locID
我不知道这些是什么但是我猜测 locID
会映射到另一个文件中的城市和国家/地区。 您是否尝试过Maxmind的Java示例?
并参阅 http://dev.maxmind.com/geoip/csv字段描述
So, I was told in my previous question that I can use the databases provided by MaxMind to determine locations.
So, I got their databases downloaded from their site. They are csv
files and open up in Excel.
InetAddress ip = InetAddress.getLocalHost()
is how I get the IP of my computer. From there I do String justIP = ip.getHostAddress()
My question is:
justIP
to a city location using the DB I just downloaded ??? I am new to this so a little help will be appreciated.
One of the files has three columns. startIPNum
, endIPNum
and locID
I do not know what these do but I guess locID
maps to a city and country location in the other file.
Did you tried the Java examples from Maxmind? http://dev.maxmind.com/geoip/downloadable#Java-8
And see http://dev.maxmind.com/geoip/csv for field descriptions
这篇关于我如何使用MaxMind的GeoIP数据库来确定位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!