Question: Write a time server and time client. Both programs should use the (unreliable) UDP transport protocol. Once your time client program starts, it should send
Write a time server and time client. Both programs should use the (unreliable) UDP transport protocol. Once your time client program starts, it should send a request for the time to the server right away. The client program gets the servers IP address (or hostname) and port number from command line arguments. The time server should respond by querying the system for the time, insert it as an integer or a string into a packet, and send it to the client. If you send back an integer, you need to put it in network byte order. The client should wait a short amount of time for a response; if the response doesn't come, it should send off another request, and repeat up to ten times before giving up. When a reply arrives, the client prints out the time on the command line and exits. If the packet contains a number, you need to convert it back to host byte order, and translate it to a human readable date/time. You define the format and syntax of request/response message. You can include statements to print out debugging messages so that you can see what is going on. You can also run WireShark to capture UDP packets on both the client and server side for debugging. Once they are known to be working properly, you can turn the debugging messages off.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
