snehalkgandhi
asked on
how to get the Ip and Port number of the server using servlets
hi
how to get the IP address and port number of the Server using servlets.i'm using tomcat 4.0.1 on linux 7.1. i need to get this IP and port. i tried InetAddress but its giving me the clients IP. its urgent.
regards
snehal
how to get the IP address and port number of the Server using servlets.i'm using tomcat 4.0.1 on linux 7.1. i need to get this IP and port. i tried InetAddress but its giving me the clients IP. its urgent.
regards
snehal
ASKER
i just tried it out in my system. and the tomcat is also running on my system. and when i tried it from another system i was getting that particular's systems default IP address
request.getHeader("host") should return the info you want
Did you try InetAddress.getLocalHost() ?
Greetings,
This question is current, but others below are not. Please update/finalize them.
https://www.experts-exchange.com/questions/Q.20155453.html
https://www.experts-exchange.com/questions/Q.20234925.html
https://www.experts-exchange.com/questions/Q.20271732.html
https://www.experts-exchange.com/questions/Q.20284005.html
Thank you,
Moondancer
Moderator @ Experts Exchange
This question is current, but others below are not. Please update/finalize them.
https://www.experts-exchange.com/questions/Q.20155453.html
https://www.experts-exchange.com/questions/Q.20234925.html
https://www.experts-exchange.com/questions/Q.20271732.html
https://www.experts-exchange.com/questions/Q.20284005.html
Thank you,
Moondancer
Moderator @ Experts Exchange
snehalkgandhi
Pls use HTML Headers to fetch the Server IPAddress.
Shyam
Pls use HTML Headers to fetch the Server IPAddress.
Shyam
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks
SKG
it was working perfectly.
Snehal
SKG
it was working perfectly.
Snehal
WHere were you running your code?