Reputation: 1301
This is my problem statement:
A multi threaded server sends out periodic message "any clients there". Client machines need to respond with message just to prove that clients do exist on a particular IP.
Doubts:
Is this how I should proceed?
In fact, I'm curious how a simple network discovery program can list all the other computers on the network without any program running on the client. Should I use Java Ping()?
Upvotes: 0
Views: 1105
Reputation: 72254
The easiest way (since Java 5) to find out if a particular client exists is to use the isReachable()
method on InetAddress, which pretty much does everything for you (you just need to specify a timeout.) The javadoc link above gives some insight into how it works. This gives some alternatives if you're pre-Java 5 (or just want to implement your own thing.)
For multiple clients, have a look here which shows how to broadcast on the server side to a particular group.
Upvotes: 3