I am able to get the IP address and Subnet Mask programatically. Is there a way we could generate all addressable host IPs with these two information?
I am just trying to develop a simple Ping Sweep module for my application.
Thanks.
PS: I am using C# .NET 3.5.
Calculate the first and last host IP addresses and then iterate over them sequentially. The first IP address is
(address & mask) + 1. The last is(address | ~mask) - 1.So if the network is
192.168.132.0and the netmask is255.255.255.0, the first eligible host IP is:The last eligible host IP is:
So the valid host addresses are
192.168.132.1through192.168.132.254inclusive.