On Mon, 11 Sep 2000, Michel wrote:

> ----- Original Message -----
> From: "Milt Epstein" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, September 11, 2000 3:01 PM
> Subject: Re: getRemoteHost(), was:Re: Help IP Address.
>
>
> > On Mon, 11 Sep 2000, Christopher K. St. John wrote:
> >
> > > Milt Epstein wrote:
> > > >
> > > > > Myself, I have no problem with getRemoteAddr(), but getRemoteHost()
> > > > > returns nothing.
> > > >
> > > > In all cases?  That could be a bug with your servlet container.
> > >
> > > Often web servers turn off name lookup, since it can be very
> >
> > But note that he said "returns nothing" above -- according to the
> > spec, as you quote below, if getRemoteHost() doesn't return the host
> > name, it should return the IP address.  (Maybe he didn't really means
> > "returns nothing" though.)
>
> Since I seem to have touched off this thread, I would clarify by
> saying that:
>
> getRemoteAddr() returns the I.P. address, but getRemoteHost()
> returns nothing.

Well, "nothing" isn't defined in the Java Language Spec, so you
haven't really clarified it :-).  I'll assume you mean null or the
empty string or something similar.  And you didn't say whether this is
in all cases or not.

It still could be a problem with your servlet container.


> I assume that
>
> 1 - getting the I.P. address is easy, since is should be sent to the
> host, to get a  response;
> 2 - getting the host name (domain name) requires a call to another
> server, and may not be readily available
>
> A work-around would be to make a call to one of the servers that
> offer a domain name look-up, and use that.

As others have pointed out, there are some situations where nothing
will work to get the host name.

Maybe if you said more about what you're trying to do (assuming you're
trying to do something :-), people can come up with some
suggestions/workarounds.

Milt Epstein
Research Programmer
Software/Systems Development Group
Computing and Communications Services Office (CCSO)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]

___________________________________________________________________________
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

Reply via email to