This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting IP and location of a client

 
Fawad Ali
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,
How can I get the location and IP address from a client's request. Any ideas?
 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4435
256
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the docs for getRemoteAddr() method. Note that it yields the IP address of the last proxy - which may probably not be the original client.
 
Fawad Ali
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Devaka:
I am replying so late to the thread but my concern here is that how do sites like google or yahoo finds the location of the client. Do they get the IP address and then search through some kind of database table or what? I have to show a client's location (country and City) on a web page but I do not know what will be the best way(approach) to do it.

 
Tim Moores
Bartender
Posts: 2802
39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Search for "maxmind geoip java".
 
Ravi Majety
Ranch Hand
Posts: 59
Eclipse IDE Java Oracle
 
Daniel Val
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fawad Ali wrote:Devaka:
I am replying so late to the thread but my concern here is that how do sites like google or yahoo finds the location of the client. Do they get the IP address and then search through some kind of database table or what? I have to show a client's location (country and City) on a web page but I do not know what will be the best way(approach) to do it.



Hi,

When google goes to that page, the page will show the location of the google spider (web crawler) , not the location of the other clients. So getRemoteAddr should be fine.

D.
 
nila ragunanthan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fawad Ali wrote:Hi guys,
How can I get the location and IP address from a client's request. Any ideas?


Hi,
You can't find the Ip-address of your clients.but if you have Ip address You can find the Location,ISP provider,Latitude,Longitude of that Ip in online sites like http://www.ip-details.com/.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic