This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes How to get the IP address of machine where the jsp file is opened Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to get the IP address of machine where the jsp file is opened" Watch "How to get the IP address of machine where the jsp file is opened" New topic
Author

How to get the IP address of machine where the jsp file is opened

Rekha Pai
Ranch Hand

Joined: Oct 30, 2008
Posts: 35
If I use the following code it gives the IP address of the machine where the tomcat server resides. How to get the address of client machine where the jsp file is opened in the browser.

InetAddress iAddr = InetAddress.getLocalHost();
out.println(iAddr.getHostName());
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3817

check the ServletRequest at Servlet API for getRemoteAddr() method.
[ November 03, 2008: Message edited by: Vijitha Kumara ]

SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Rekha Pai
Ranch Hand

Joined: Oct 30, 2008
Posts: 35
Originally posted by Vijitha Kumara:
check the ServletRequest at Servlet API for getRemoteAddr() method.

[ November 03, 2008: Message edited by: Vijitha Kumara ]


Thanks Vijitha.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get the IP address of machine where the jsp file is opened
 
Similar Threads
Finding the IP Address of Remote Machines if any connected to my Current machine
How to get IP Address of Client Machine?
File Creation
Getting Client Information
How to get the IP address of machine where the jsp file is opened