Thursday, July 05, 2001, 11:35:55 PM, [EMAIL PROTECTED] wrote:

DW> Is there a class that can do a reverse DNS lookup, giving me the hostname
DW> that matches a given IP address?  I'm able to retrieve the IP address of an
DW> HTTP request just fine using request.getRemoteAddr() (and getRemoteHost()
DW> returns the same IP address dotted numbers), but the java.net package
DW> doesn't seem to have
DW> anything that returns a name based on an IP address, unless I'm just
DW> misreading InetAddress...

InetAddress.getByName(<ip address>).getHostName() will do what you
want, if the info is available.

getRemoteHost() doesn't work if the webserver is configured not to
spend time doing the lookup for every request, or if no rDNS record
exists for that IP.

DW> David


Reply via email to