Not all IP addresses have valid reverse lookup zones.

All names must resolve to valid IP addresses to work.  There is no such
requirement for IP addresses; IP addresses may or may not resolve to domain
names.  It is up the domain administrator for that IP block to implement IP
reverse lookup zones (IP->names).  Whether the IP address resolves to a name
or not has nothing to do with tomcat or Java, or servlets or JSP.  You would
have the same issue if you were using perl, PHP, ASP, whatever.

If this is a serious issue for you, you can go to http://www.arin.net and
click on Whois, then type in the IP address in question.  You will be
presented with the contact information for the person or company that has
responsibility for that address block, and you can contact them and ask them
to implement an IP reverse lookup zone for the IP address in question.  Note
that not only can they deny/refuse your request without penalty, but they
may very well have delegated the responsibility for some of all of their
address block to someone else, and refuse to give you their contact
information if you aren't from ARIN.

John Turner
[EMAIL PROTECTED]


-----Original Message-----
From: Jack Li [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 18, 2002 12:09 PM
To: 'Tomcat Users List'
Subject: RE: getRemoteHost(): how to get the fully qualified name?


I applied your method to get the names. It works for some IPs. It didn't the
name of other IPs. For example, 12.5.203.134 was not converted to a name.
Any ideas?

Thanks,
Jack

-----Original Message-----
From: Shapira, Yoav [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 18, 2002 11:31 AM
To: Tomcat Users List
Subject: RE: getRemoteHost(): how to get the fully qualified name?


Howdy,
You can convert IP to host name yourself.  Here's the relevant section
of the code:

String ipAddress = "123.456.789.123";
InetAddress ia = InetAddress.getByName(ipAddress);
String hostname = ia.getHostName();

As you will by experimenting, the above has the desirable property of
working whether ipAddress is nnn.nnn.nnn.nnn or the host name.  So you
can pass whatever you get from getRemoteHost() through this.

The assumption you mention (the fully qualified name is available to the
Solaris the server is running on) is important.  The above will throw an
UnkownHostException if the assumption is broken.

Good luck,

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, July 18, 2002 11:18 AM
>To: [EMAIL PROTECTED]
>Subject: getRemoteHost(): how to get the fully qualified name?
>
>Hi all
>
>When I call the ServletRequest's getRemoteHost()-method, I get
sometimes
>the
>fully quialified name and sometimes the IP of the remote host. This is
the
>case also, if the fully qualified name is aviable to the Solaris the
server
>is running on (using nslookup). Now, is there a way to force the
>Servlet-Engine to deliver the fully qualified name instead of the IP
all
>the
>times?
>
>Thanks for any help.
>Philipp

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to