Home All Groups Group Topic Archive Search About
Author
24 Apr 2006 3:22 AM
Terry Olsen
Is there an "elegant" way to determine if an IP address is on my subnet? Or
do I just compare the first 2 or 3 octets?

Author
24 Apr 2006 3:28 AM
Tom Dacon
The elegant way is get both the subnet address and the IP address as 32-bit
unsigned integers, and AND them together. If the result equals the subnet,
it's on the subnet.

HTH,
Tom Dacon

Show quoteHide quote
"Terry Olsen" <tolse***@hotmail.com> wrote in message
news:%23jYDH50ZGHA.5088@TK2MSFTNGP03.phx.gbl...
> Is there an "elegant" way to determine if an IP address is on my subnet?
> Or do I just compare the first 2 or 3 octets?
>