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","java.net.InetAddress")
theHost = inetAddress.getByName("209.200.101.202").getHostName();
</cfscript>
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 dnsjava.org 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("209.200.101.202");
for(x = 1; x LTE arrayLen(dnsRecords); x = x + 1){
writeOutput(dnsRecords[x]);
}
</cfscript>
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.


Phill Nacelli has been architecting and developing software solutions for over 10 years. He has lead the engineering and development of multiple enterprise web based applications for the Federal Government, Commercial Software, and non-profit association/education market. He enjoys playing with the latest in programming techniques, frameworks and development tools. Phill is very active in the Adobe ColdFusion community as a member of the Adobe Community Professional Program, serving as the Capital Area ColdFusion User Group Manager, Adobe ColdFusion Customer Advisory Board. He's also involved in speaking at technical conferences, writing technical articles, user group presentations, community forums/chat rooms support and via this blog. He is currently the Senior Software Architect - Solutions Lead at



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..
Cheers..
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...
The return data type is an array for cases where there are multiple dns records pointing to the same ip address being queried.
Cheers,
Phill
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.
Welcome to http://www.queentorrent.com
Here you can download a good movie