I am working on a Java application with which people can send data between devices on a network. Every device with the code installed is running a TCP server and is listening on a certain port. Now I would like the user to have the option to "scan" the network for other devices running my code, and display a list on the screen to select which device to send data to.
How can I find which devices are running my code?
I can only think of two ways:
So i kindly ask you, is there a better way of achieving this?
Thank you.
The way I do this is to broadcast a periodic "heartbeat" via multicast and listen for that. Nowadays the best practice is to use multicast DNS using something like jmDNS (https://github.com/openhab/jmdns).