tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@mailops.com
Subject Re: Remove DNS lookup
Date Fri, 06 Jul 2001 03:56:42 GMT


Thursday, July 05, 2001, 11:35:55 PM, dwall@myEastside.com 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



Mime
View raw message