|
-
January 23rd, 2003, 02:58 PM
#1
How to get the IP address in JSP?
Hi. Could someone tell me how to get the IP address of all clients connected to the server in jsp? Also, I want to know how to get the IP address of my machine in jsp. Please can anyone help me?
-
January 23rd, 2003, 04:42 PM
#2
Code:
// gets the remote IP
String sIPAddress = request.getRemoteAddr();
Not sure how to get your local IP.
-
January 23rd, 2003, 06:34 PM
#3
InetAddress.getHostAddress() returns the IP address of the local host (oddly enough ).
All things have savour, though some very small,
Nay, a box on the eare hath no smell at all...
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
-
January 25th, 2003, 04:40 PM
#4
Hi. I already know the InetAddress.getHostAddress but I wanted to know if there is something specific in jsp to get the local IP address ,e.g, request.something
-
January 25th, 2003, 05:18 PM
#5
I'm not really sure I understand you... are you saying you think there should be another method to return the local IP address besides InetAddress.getHostAddress()?
If you want request information, I suppose you could call HttpServletRequest.getRequestURL() to get the URL the client used to make the request. This will include the protocol, server name, port number, and server path, but it won't necessarily be the IP address.
Those whom God wishes to destroy, he first makes mad...
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|