I developing an app that connects devices on the same network.
Any devices can be the server, I want clients to be able to find the server automatically without users having to enter the IP address of the server manually.
This is how I plan to do it:
- Find the IP of the client, eg 192.168.0.2
- Loop through 192.168.0.(0->255)
- Try to connect with all those IPs until the connection success
Is that the right way? Can I do it faster? Do IP on the same network always in the range of x.x.x.(0->255)?
I'm using both Java and JavaScript(Node.js) if that is relevance.