Create a client-server system to enhance your lookup program (Program 4)
by broadcasting for a server. The client will broadcast the request
and the servers will do the lookup. What happens next is of interest:
servers with no information can do nothing, or they can send a failure
message. Normally, they should remain quiet to reduce the load on the
network, but that means that the client could hear nothing. Lets say
that they do nothing, so that the client needs a timeout period. If
nothing is heard, assume that no information is available. Set the
timeout period to 10 seconds. Note that we have gone back to the UDP
version of the program.
You
will need at least three servers running on the same port number on
different machines. Broadcast a request and wait up to 10 seconds for
a reply, but stop waiting after any response.
You will need to set up a timer
to handle the timeout. For each server that responds, output the
information. The broadcast mechanism should be written
as a modular unit. For example,
Broadcast (network_address, port, message, timeout, host_list)because this is a common activity that should be standardized. The host_list would be the information about the hosts that responded.
This is a rather simplistic program, but it has lots of uses. For example, finding servers for file sharing, finding machines that can provided DHCP or BOOTP support, or finding sites that provide directory services.
Turn in your source and scripts showing what your client and servers did. Try requests that succeed and fail and output some sort of message when no response is found.