This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IP address retrieval

 
sunil kumre
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
I'm writing a servlet which will be put on our server.
A client can make a request for this servlet.I would like to retrieve the IP address of the client machine(which could be behind a firewall).What code should be put in the servlet to make this happen.
Thanks in advance
Sunil
 
Manjunath Subramanian
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

You can make use of the method getRemoteAddr() declared in the
ServletConfig interface,implemented by HttpServletRequest class
This method will return the string equivalent of the client
IP address.The firewall shouldn't be a problem.
Hope this helps,
Manjunath
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic