Does anyone have working code on how to calculate a subnet from an IP address? I've seen a couple posts here but it's not helping me much. Normally I don't mind figuring things out myself but this time I'm just flat out going to ask for someone to hold my hand!
The deal is this: My app scans all possible addresses for satellite receivers. On most typical networks this happens within a couple minutes. Basically I do this:
If the IP address of the device is 192.168.1.110, then I try sending an HTTP request to 192.168.1-254 (not including 110). However, a customer recently emailed to tell me he only has around 32 possible IP addresses on his network (not 254) and my scan takes 30 whopping minutes! Not good at all. So he has been talking about subnet masks, and subnets, etc, to determine the actual range of possible addresses on the network.
The only problem is that it is all over my head and I don't understand any of it.
So if anyone has some working code for determining a valid range of IP addresses on a network initially derived only from a single known IP on the network (i.e. the IP address of the Android device on the network) I'd appreciate if you can help.
Apparently one can get the subnet with a combination of an actual IP address and the default subnet mask for that network type (A, B, or C). That is all I know.
Thanks!
The deal is this: My app scans all possible addresses for satellite receivers. On most typical networks this happens within a couple minutes. Basically I do this:
If the IP address of the device is 192.168.1.110, then I try sending an HTTP request to 192.168.1-254 (not including 110). However, a customer recently emailed to tell me he only has around 32 possible IP addresses on his network (not 254) and my scan takes 30 whopping minutes! Not good at all. So he has been talking about subnet masks, and subnets, etc, to determine the actual range of possible addresses on the network.
The only problem is that it is all over my head and I don't understand any of it.
So if anyone has some working code for determining a valid range of IP addresses on a network initially derived only from a single known IP on the network (i.e. the IP address of the Android device on the network) I'd appreciate if you can help.
Apparently one can get the subnet with a combination of an actual IP address and the default subnet mask for that network type (A, B, or C). That is all I know.
Thanks!