Open AtmanActive opened 1 year ago
I have only tested the app with the normal /24 subnet but haven't thought of other subnet configurations. I assume if your phone has an ip of e.g. 192.168.0.25
only devices which also have a zero in the third octet are discovered e.g. 192.168.0.26
but devices which have an IP address of 192.168.1.27
are a) not discoverable in the network scan and b) even if you add them manually, they can't be woken up? Can you provide me an example IP address for a device which can't be woken up and the corresponding correct broadcast address? (It doesn't has to be the specific IP address but an example would help a lot!)
There is a flutter package called network_info_plus which I am already using and which returns the right subnet. This would allow me to scan the whole network, but the larger the network gets, the longer the scan takes (In your case with /23
it would already take double the amount of time for a /24
network, /22
4 times and so on). For the device itself, I can implement an extra field where for each device a specific broadcast address to wake the device up can be specified. But I would like it better if my app calculates it automatically so the ui is more minimalistic.
So my phone has an IP address of 192.168.150.18, but my network's subnet mask is 255.255.254.0. That means that my network uses IP addresses from 192.168.150.0 to 192.168.151.255. If the app assumes /24 network, then, it will incorrectly assume that my network's broadcast is at 192.168.150.255. On the other hand, if the app would get both the IP address and the subnet mask from android and calculate from there, then, it would get the correct broadcast address, which is 192.168.151.255 in my case. The bug stems from assuming the broadcast address instead of calculating the broadcast address. Maybe obtaining the subnet mask from android is the problem?
Was testing several Wake on LAN apps from F-Droid and this one doesn't work on my network. My network is a bit specific as it is /23 wide, not /24, like most are. The other competing app had a broadcast address input box where I could enter my specific broadcast address and that one works on my LAN.
Suggestion: either allow manual input of LAN broadcast address or do a proper broadcast calculation by querying android for both IP and mask.
Thanks.