0

Hopefully, some one can help me with this issue. I am trying to implement a global site and hence was looking for a way to detect user location. I do not want to use any ip2location webservice or download a database or ask for user to "share location".

Anyways, I found this project. I implemented it , it detects my location correctly (US). However for my friend in Germany it is returning an empty string for Country.

http://javainetlocator.sourceforge.net/. I am using jar file from here.

I am using CF 11 and my code is on

http://roomdu.com/geolocator/

PLEASE SUGGEST ME

Roomdu
  • 23
  • 2
  • 3
    Are you aware that the same issue exists for the demo link provided on the sourceforge page you provided?http://www.sustainablegis.com/projects/geoLocator/ In other words, it's not your implementation, it's the vendor code that is the problem. – Codezilla Nov 15 '14 at 18:48
  • you'd be better off using a service like MaxMinds GeoIP service, which you can either buy or use their free version: http://dev.maxmind.com/geoip/geoip2/geolite2/ reading through the sourceforge link, it looks like it's using a vague hardcoded version of maxmind anyway, so using a DB would mean the data is more upto date – Jarede Nov 15 '14 at 19:02
  • Hi All, Thanks for your quick responses. Yes, It make sense. Its a problem with the " InetAddressLocator". However what do you think will be best way to achieve. I am not fully convinced with database or webserivce due to performance reasons. Any one had experience in past? – Roomdu Nov 15 '14 at 19:42
  • what performance reasons are you having issue with? – Jarede Nov 16 '14 at 01:02

1 Answers1

3

Some German IPs are not in the IP database provided with InetAddressLocator. You can see this by running it in interactive mode via command line.

Codemans-MacBook:ColdFusionMX-geoLocator-2.23 Codeman$ java -jar InetAddressLocator.jar

  InetAddressLocator - Java country lookup.
  -----------------------------------------
  Copyright (C) 2003-05 Nigel Wetters Gourlay and Paul Hastings
  InetAddressLocator comes with ABSOLUTELY NO WARRANTY.
  This is free software, and you are welcome to redistribute
  it under the GNU General Public License.

  Running benchmark. Please be patient...
    Speed: 1260307 ops/sec
           (61% of address space is allocated)

  Locating localhost
    Host: /192.168.15.238
    Country: Unknown (private network)

  enter host ('q' to quit) > 5.199.139.54
    Host: /5.199.139.54
    Country: Unknown
Codezilla
  • 400
  • 1
  • 7
  • Hi All, Thanks for your quick responses. Yes, It make sense. Its a problem with the " InetAddressLocator". However what do you think will be best way to achieve. I am not fully convinced with database or webserivce due to performance reasons. Any one had experience in past? – Roomdu Nov 15 '14 at 19:41