Reverse DNS Lookup in ColdFusion

I've began building an internet services utility component for doing things like DNS lookup in ColdFusion. It's basically a wrapper to simplify all the JAVA integration calls.

Although I can technically do the following to do a dns lookup from an ip address natively in ColdFusion:


inetAddress = createObject("java","")
theHost = inetAddress.getByName("").getHostName();


The preceding code can take up to 5 seconds if there's no dns record for the given ip address. In most applications that wait is not exactly acceptable! The InetUtils.cfc uses a java jar file from that speeds up the lookup even when there's no dns record.

Here's a sample code on how to use it, it also returns all dns records found for the ip address as an array, where the previous code only returns one record:


inetUtils = createObject("component","InetUtils").init();
dnsRecords = arrayNew(1);

dnsRecords = inetUtils.reverseDNS("");

for(x = 1; x LTE arrayLen(dnsRecords); x = x + 1){


I'll be adding new methods like dns lookup and any other methods that fit this library later on. If you have any ideas or requests, I'd be happy to hear it.

zip file is invalid...
# Posted By Nathan Miller | 2/21/07 2:39 PM
Hi Nathan,

Thanks for the heads up, I had originally compressed the files using winRaR format and then renamed the extension to .zip. I have fixed the file an re-uploaded it, give it a shot and let me know if you have any problems..

# Posted By phill.nacelli | 2/21/07 2:56 PM
Hi Phill,

thanks for this, excellent.. Quick question, can the reverse lookup return more than one record? I was under the impression it would only ever return one record. Which is why I was suprised to see an array returned.

Whahoo, also having some issues submitting this post, the captcha is pretty complicated...
# Posted By Taco Fleur | 12/3/07 3:48 PM
@Taco Fleur

The return data type is an array for cases where there are multiple dns records pointing to the same ip address being queried.


# Posted By phill.nacelli | 12/3/07 4:38 PM
Befor I recommend download books ( see - rapidshare results) about DNS and how DNS work. After this article will be more useful for you.
# Posted By tyto | 2/3/09 3:50 AM
thank you for your article
# Posted By rapidshare search | 2/17/09 9:09 AM
thank you for this article
# Posted By rapidshare search | 2/17/09 11:06 AM
Thanks for the article, If I can get it to work it'll be a huge help. Im getting an error when trying to use your component:

Object Instantiation Exception.
Class not found: org.xbill.DNS.ExtendedResolver
InetUtils.cfc: line 49

Im trying to look up 10,000 Host Names at a time and ColdFusion ends up timing out on the addresses it can't resolve.

I appreciate any help you can give me.
# Posted By Greg | 6/2/09 2:44 PM
Actually, I feel dumb about my last post. Forgot to restart coldfusion. Sorry about that. Chances are I'll figure out the answer before you can get back to me, but even though this method is much faster, I was wondering if there was a way to set the timeout to a shorter period. In the event something takes longer than a second, we just want to say forget about it and keep moving.
# Posted By Greg | 6/2/09 3:13 PM
what the "inetUtils.reverseDNS" mean?
# Posted By inspiron6400 | 7/3/09 8:45 PM
ColdFusion is a very convenient system, and perfectly complements Google, thanks to that work on it, and publish settings.

Welcome to
Here you can download a good movie
# Posted By Katty Lee | 7/13/09 2:36 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.003. Powered by ColdFusion Server v8,0,1,195765.