Hi Vijay..
What exactly do you want..? The remote host(ipaddress) that invoke the
servlet request..?
or the server ipaddress..?
Whatever you want..i think there most be something like in Perl that
should give you those envieroment variables....look up in your servlet
doc..I hope you get it!
It must be something like <obj>.getRemoteHost();
([.getRemoteAddress()])-may be-.
Thank in advance
;-)) Romel.
sorry for my english!
On Fri, 12 Jan 2001, kwai kwai wrote:
> Hi,
>
> I had 2 programs which are exactly the same in the way
> they get the Hostname and Ip address.
>
> The one which i ran from command line and other was
> run as servlet.
> Both used the following code to get the ip address,
> java.net.InetAddress localHost =
> java.net.InetAddress.getLocalHost();
> ipAddress = localHost.getHostAddress()
>
> When run from command line,
> localHost=mypc/125.25.20.1
> ipaddress = 125.25.20.1
>
> When run as servlet,
> localHost=mypc/127.0.0.1
> ipaddres= 127.0.0.1 (loop back address)
>
> Environment: Windows 2000, Apache
> This was working on my solaris environment...
>
> I saw in one of the doc pages that the java libs
> dont return the actual ip address to an untrusted
> applet..I am not using an applet.
>
> Could it be anything to do with the dns setup ?
> my nslookup gives an error, but my "hosts" file
> has the proper ipaddress for my hostname..
> But if it was DNS problem, why do i get IP address
> from command line ?
>
> Thanks in advance
> Vijay
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Photos - Share your holiday photos online!
> http://photos.yahoo.com/
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html