calcNetAddress(myIP, myNetMask)
Last updated May 12, 2003
Version: 1 | Requires: ColdFusion 5 | Library: NetLib
Description:
calculate a network address from an IP address and a (sub)Netmask. Does not validate either input parameter.
Return Values:
Returns an IP address (string).
Example:
#calcNetAddress('217.136.252.232','255.255.255.197')#
</cfoutput>
Parameters:
| Name | Description | Required |
|---|---|---|
| myIP | IP Address. | Yes |
| myNetMask | Netmask. | Yes |
Full UDF Source:
<cfscript>
/**
* calculate a network address from an IP address and a (sub)Netmask.
*
* @param myIP IP Address. (Required)
* @param myNetMask Netmask. (Required)
* @return Returns an IP address (string).
* @author Tanguy Rademakers (t@newmediatwins.net)
* @version 1, May 12, 2003
*/
function calcNetAddress (myIP, myNetMask) {
var NetAddress = "";
var i = 1;
for (i = 1; i lte 4; i = i + 1) {
NetAddress = ListAppend(NetAddress, BitAnd(ListGetAt(myIP,i,'.'),ListGetAt(myNetMask,i,'.')) ,'.');
}
return NetAddress;
}
</cfscript>
Search CFLib.org
Latest Additions
Tayo Akinmade added
arrayTrim
11 day(s) ago
Will Belden added
longTime
17 day(s) ago
James Sleeman added
quickSort
27 day(s) ago
Ben Forta added
GetHostAddress
30 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)