Question: In this programming assignment, you will write a client ping program in Java based on UDP. Your client will do the following: send a simple

In this programming assignment, you will write a client ping program in Java based on UDP.

Your client will do the following:

  1. send a simple ping message to a server, receive a corresponding pong message back from the server.

  2. determine the delay between when the client sent the ping message and received the pong message. This delay is called the Round Trip Time (RTT).

  3. your ping program is to send 10 ping messages to the target server over UDP. For each message, your client is to determine and print the RTT when the corresponding pong message is returned.

*Because UDP is an unreliable protocol, a packet sent by the client or server may be lost. For this reason, the client cannot wait indefinitely for a reply to a ping message. You should have the client wait up to one second for a reply from the server; if no reply is received, the client should assume that the packet was lost and print a message accordingly. (set a timer)

In this assignment, you will be given the complete code for the Server(No need to change anything in Server Class) & Client Class(this is what you will work on it) (available via this link).

Your job is to write the client code, which will be very like the server code. It is recommended that you first study carefully the server code.

*Note:

*You can then write your client code, liberally cutting and pasting lines from the server code with some functionalities to do the required tasks.

* To calculate RTT, you may use your system clock (system.nanotime();) to calculate the RTT.

*You must write comments on top of each method/work you do.

*You are required to submit your running project as Java Project with all itsclasses.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!