Howdy,
See John Turner's response: it's not required for an IP address to have
a host name associated with it.  The reverse is true, every host name
must have (at least one) IP address associated with it.

So it could be the IP address you couldn't resolve doesn't have a
hostname.  Can you get a hostname for it using nslookup?  If not,
there's nothing one can do.

The Arin/Whois approach is good for a human.  However, it's not yet a
public service API (AFAIK), so you can't use it programmatically which
is what Mr. Li is looking for.

Yoav Shapira
Millennium ChemInformatics


>-----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:tomcat-user-
>[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:tomcat-user-
>[EMAIL PROTECTED]>

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

Reply via email to