R. David Murray wrote: > A network is conventionally represented by an IP address in which the > bits corresponding to the one bits in the netmask are set to zero, plus > the netmask. Okay, that's clarified things for me, thanks. In that case, we shouldn't be talking about a "network address" at all, but just a "network", and it makes sense to have 1) A class called IPNetwork that contains an IP number and a mask, with the IP number constrained not to have any ones where the mask has zeroes, and 2) A class called IPAddress which only contains an IP number. It seems that some people would also like to have 3) A class called IPAddressWithMask that contains an IP number and a mask, with no constraints, but I'm not enough of an expert to know whether such a thing would be used often enough to be worth having a special type for it, as opposed to using an (IPNetwork, IPAddress) pair, or attaching a 'network' attribute to an IPAddress, or some other solution when the need arises. -- Greg
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4