long2ip(longip)
Last updated January 9, 2009
Version: 0 | Requires: ColdFusion 8 | Library: NetLib
Description:
Generates an (IPv4) Internet Protocol dotted address (aaa.bbb.ccc.ddd) from the proper address representation. Returns 0 if error occurs.
Return Values:
Returns the IP as a string.
Example:
Parameters:
| Name | Description | Required |
|---|---|---|
| longip | Numeric version of IP address. | Yes |
Full UDF Source:
<cfscript>
/**
* Generates an (IPv4) Internet Protocol dotted address (aaa.bbb.ccc.ddd) from the proper address representation.
*
* @param longip Numeric version of IP address. (Required)
* @return Returns the IP as a string.
* @author Troy Pullis (tpullis@yahoo.com)
* @version 0, January 9, 2009
*/
function long2ip(longip) {
var ip = "";
var i = "";
if (longip < 0 || longip > 4294967295)
return 0;
for (i=3;i>=0;i--) {
ip = ip & int(longip / 256^i);
longip = longip - int(longip / 256^i) * 256^i;
if (i>0)
ip = ip & ".";
}
return ip;
}
</cfscript>
Search CFLib.org
Latest Additions
Tayo Akinmade added
arrayTrim
3 day(s) ago
Will Belden added
longTime
9 day(s) ago
James Sleeman added
quickSort
19 day(s) ago
Ben Forta added
GetHostAddress
22 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)