if the first address is 10.158.0.1, and the mask is 255.255.252.0 then
the first available address is 10.158.0.1, and the last possible address is 10.158.3.254, not 2.254.Code:Host/Net - 1022 = 1024 - 1 for network# and - 1 for directed broadcast. Network Broadcast 10.158.0.0 10.158.3.255 IP 00001010 10011110 00000000 00000001 10.158.0.1 Mask 11111111 11111111 11111100 00000000 255.255.252.0 Net 00001010 10011110 00000000 00000000 10.158.0.0 Hosts 00000000 00000000 00000011 11111111 1023 CIDR 22
copy the code i provided to a module.
then insert this into your code
Code:Dim RetStr As List(Of String) RetStr = ipRange("10.158.0.1", "255.255.252.0") For nn As Integer = 0 To RetStr.Count - 1 Debug.WriteLine(RetStr(nn)) 'show the results ' My.Computer.Network.Ping(RetStr(nn)) Next




Reply With Quote