Network discovery in Java using UDP broadcast,

486 Views Asked by At

I got a bunch of clients(slaves) that listen to the messages from the server(master). I am trying to create a utility to discover the clients. So in order to do that, I am going to broadcast a message to the subnet IP address (192.168.1.255). So far so good. Now when I receive the packet (DatagramPacket) I am going to use the getAddress method to figure out the client IP addresses. But my question is after I broadcast the message then all the clients sends the response back but when I receive the response with .receive method from which client I received the response and what should I do to get all the client IP addresses? Do I need to send the message from the master several times and check the response each time and check the packet to get the address? What is the best way to do that? Any help appreciated!

0

There are 0 best solutions below