Computer Science 360 Assignment 2 Due 11:59 PM Feburary 4 Develop a program called udping that can function as either a udp ping server (which simply echoes udp ping packets back to there source) or as a ping client which works similarly to the standard ping program. The program must support the following command line options: Default Value -c ping-packet-count (stop after sending this many) 0x7fffffff -i ping-interval (interval in seconds between ping sends) 1.0 -p port number (the port number the server is using) 33333 -s size in bytes (of the application data sent) 16 -n no_print (only print summary stats) print all -S Server (operate in server mode) client mode The last command line parameter is the host name of where the server is running. Example: udping -S -p 50000 (starts the server and binds it to port 5000) udping -i 0.1 -c 100 -s 200 -p 50000 jmw (send 100 pings of size 200 bytes at a rate of 10 pings per second to a server running on host jmw) Example output: notes (1) command line options should be echoed to the stderr (2) other output data should go to the stdout (3) in the default mode one line should be printed for every ping RECEIVED BY THE CLIENT (The server should not print anything). The line should contain The sequence number carried by the ping packet The number of bytes of application data The round trip time in milliseconds in the format shown (4) The statistics lines should be printed after the number of pings specified have been sent or the user terminates the client with a Ctrl-C acad/cs360/examples ==> ./udping -c 10 -s 300 -i 0.1 -p 33333 jmw Count 10 Size 300 /___________________ Goes to stderr Interval 0.100 \ Port 33333 1 300 0.104 2 300 0.035 3 300 0.027 4 300 0.035 5 300 0.025 /___________________ Goes to stdout 6 300 0.026 \ | 7 300 0.025 | 8 300 0.050 | 9 300 0.025 | 10 300 0.025 V 10 packets transmitted, 10 received, 0% packet loss, time 1004 ms rtt min/avg/max = 0.025/0.038/0.104 msec If the -n option is used then printing of individual responses should be suppresed. acad/cs360/examples ==> ./udping -c 100 -s 300 -i 0.01 -n jmw Count 100 Size 300 Interval 0.010 No print 100 packets transmitted, 100 received, 0% packet loss, time 1003 ms rtt min/avg/max = 0.016/0.026/0.108 msec Implementation requirements: (0) Use the getopt() function to parse the command line arguments (1) When operating in client mode, the program MUST create two child threads. One thread will send pings and the other will receive them. In server mode NO THREADS should be created. (2) The sender() thread MUST use the pthread_cond_timedwait() function to wait until it is time to send the next ping. The proper time to send is: start_time + (seq# - 1) x ping-interval (3) The receiver thread MUST compute the round trip time of the ping, the number of pings received, the min, max, and sum of the round trip times. (4) Round trip times must be computed to (nominally) microsecond level accuracy using the gettimeofday() function. (5) The signal() function must be used to set up handler that will print the statistics lines and the exit(0) if the user enters CTRL-C.