Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get visitors IP address in Java?

 
Vicky Thakor
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I searched whole google, tried tons of codes but can't find answer how to get visitors ip address...




You can check out on my website... it shows 127.0.0.1

http://www.0signals.com/test/
 
Tim Moores
Bartender
Pie
Posts: 2493
7
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this: http://en.wikipedia.org/wiki/X-Forwarded-For
 
Vicky Thakor
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


This will give you IP address of visitor you can read thie article

How to get visitors IP address in Java?
http://www.javaquery.com/2011/12/how-to-get-visitors-ip-address-in-java.html
 
Tim Moores
Bartender
Pie
Posts: 2493
7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure what you're asking; can you rephrase the question with more detail? Are you saying the x-forwarded-for header doesn't contain the IP address? If so, talk to your system admin for where else you might look for it. It's also possible that header hasn't been set up.
 
Vicky Thakor
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim i got the solution and thank you.....I pasted code here so other who visit this thread can find the solution...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic