GetHostName(address)
Last updated December 19, 2001
Version: 1 | Requires: ColdFusion 5 | Library: NetLib
Description:
DNS lookup, provide an IP address, it'll return a host name. If the address is invalid an exception will be throw, so <CFTRY>/<CFCATCH> should be used.
Return Values:
Returns a domain name.
Example:
#GetHostName(CGI.REMOTE_ADDR)#<br>
<i>Note, since we cache pages, the result of this test will not reflect your remote address.</i>
</CFOUTPUT>
Parameters:
| Name | Description | Required |
|---|---|---|
| address | IP address to look up. | Yes |
Full UDF Source:
<cfscript>
/**
* Performs a DNS lookup on an IP address.
*
* @param address IP address to look up.
* @return Returns a domain name.
* @author Ben Forta (ben@forta.com)
* @version 1, December 19, 2001
*/
function GetHostName(address) {
// Variables
var iaclass="";
var addr="";
// Init class
iaclass=CreateObject("java", "java.net.InetAddress");
// Get address
addr=iaclass.getByName(address);
// Return the name
return addr.getHostName();
}
</cfscript>
Search CFLib.org
Latest Additions
Tayo Akinmade added
arrayTrim
10 day(s) ago
Will Belden added
longTime
15 day(s) ago
James Sleeman added
quickSort
25 day(s) ago
Ben Forta added
GetHostAddress
28 day(s) ago
Top Rated
EksporSQLData
Rated 5.0, 16 time(s)
backupDatabase
Rated 5.0, 13 time(s)
indentXml
Rated 5.0, 10 time(s)
generateSsccAsn
Rated 5.0, 4 time(s)