tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Waseem Azhar" <waseem...@gmail.com>
Subject Re: how to obtain server ip address
Date Tue, 18 Sep 2007 05:15:11 GMT
Yes I want to obtain IP address programmatically, Thanks for the quick help.


-Azhar


On 9/18/07, Lilianne E. Blaze <lilianne_blaze@tlen.pl> wrote:
>
> Check java.net.NetworkInterface, it lets you enumerate all interfaces
> and addresses / interface. Discard loopback 127.0.0.1 and private
> addresses (see rfc 1918), with any luck there should be one address
> remaining. Of course, that is assuming your machine is directly exposed
> to the internet.
>
> http://java.sun.com/j2se/1.5.0/docs/api/java/net/NetworkInterface.html
> http://www.ietf.org/rfc/rfc1918.txt
>
> Or you could use ServletRequest.getLocalAddr(), it's simpler but
> obviously unavailable until someone actually connects to your server, so
> it's unusable with any kind of eager initialization.
>
> Greetings, Lilianne E. Blaze
>
> Waseem Azhar wrote:
> > Hi,
> >
> > How do I obtain the IP address of the machine (where the tomcat tomcat
> > server in running) ? My web app is deployed on tomcat server and I want
> to
> > know the Ip address of the server in my application.
> >
> > Thanks in advance.
> >
> > -Azhar
> >
> >
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message