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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started