I've to perform several steps in loop.
For each IP in the local subnet:
For each IP in the local subnet:
Ping the IP. If not available (within a small/tuneable timeout eg. 200 ms), move on to next IP
If the IP pings back, send a POST authentication request.
Stop after an IP is authenticated succesfully.
Finally save the IP in the database for future use.