calcNetAddress(myIP, myNetMask)
Last updated May 12, 2003
Version: 1 | Requires: CF5 | 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:
<cfoutput>
#calcNetAddress('217.136.252.232','255.255.255.197')#
</cfoutput>
Parameters:
Name | Description | Required |
---|---|---|
myIP | IP Address. | Yes |
myNetMask | Netmask. | Yes |
Full UDF Source:
/**
* 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;
}
Search CFLib.org
Latest Additions
Raymond Camden added
QueryDeleteRows
November 04, 2017
Leigh added
nullPad
May 11, 2016
Raymond Camden added
stripHTML
May 10, 2016
Kevin Cotton added
date2ExcelDate
May 05, 2016
Raymond Camden added
CapFirst
April 25, 2016