Link to home
Start Free TrialLog in
Avatar of snehalkgandhi
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
Avatar of Mick Barry
Mick Barry
Flag of Australia image

> i tried InetAddress but its giving me the clients IP.

WHere were you running your code?
Avatar of snehalkgandhi
snehalkgandhi

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()?
snehalkgandhi

Pls use HTML Headers to fetch the Server IPAddress.

Shyam
ASKER CERTIFIED SOLUTION
Avatar of skg_bfn
skg_bfn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks
SKG
 it was working perfectly.

Snehal