Question: Write a UDP client program that sends and receives datagrams. It will have to send and receive, with these actions being asynchronous . This can

Write a UDP client program that sends and receives datagrams. It will have to send and receive, with these actions being asynchronous. This can be done with threads or with non-blocking I/O.

Assume that there is a server c program that is going to "echo" the message back to your UDP client c program

In the main function Get time now, put in message, do sendto

In the thread use the recvfrom, to extract the time and Get time now, Extract time sent from message received, compute delta time, accumulate total delta times,increment num_received .

In the main function Wait for any straggler replies, Compute ave RTT, compute message loss percentage

If the main thread sleeps for 2 seconds, any straggler replies will have time to turn up and be seen by the recvfrom thread

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!