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?
Printable View
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?
Not sure how to get your local IP.Code:// gets the remote IP
String sIPAddress = request.getRemoteAddr();
InetAddress.getHostAddress() returns the IP address of the local host (oddly enough :cool: ).
All things have savour, though some very small,
Nay, a box on the eare hath no smell at all...
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
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...