Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a code in UDP Java 1. The client should send a ping consisting of exactly 1,000 (one thousand) bytes for each ping. These bytes
Write a code in UDP Java
1. The client should send a ping consisting of exactly 1,000 (one thousand) bytes for each ping. These bytes should consist of alternating ones and zeros (that is the binary pattern 1010101....0) - the byte pattern is OxAA repeated. 2. The server should check if the ping consists of 1,000 bytes of alternating bit pattern - else should print an error. If the pattern is correctly received, the server should echo the ping with its pong of the same 1,000 bytes. 3. 4. The client should check if the pong received from the server matches the alternating bit pattern - else should print an error; if no error, then the client should record the RTT for these 1,000 bytes in ms. One trial consists of 10 pings and pongs and your program should calculate the average RTT of each of these ten pings/pongs and print them to two decimal digits. Time unit for the average should be ms. You should perform this trial three times that is the client program must be run three times; do not code the three trials in the same program. 5. 6. You should compute the average data rate (in Mbps) for each trial consisting of 10 pings and pongs using the formula given below and your program must print this data rate as well after each trial (rounded to 1 decimal digit): UDP: Server Location Average data rate localhost 7. Run the server on the localhost and perform Steps 4, 5, and 6 above. 8. Make sure your program prints the RTT and the average data rate only once at the end of each trial (consisting of 10 pings & pongs). 9. Give the response in a tabular form as shown in the example below in a separate pdf file. RTT Average for First Trial (10 pings) 0.17 ms 16 Average RTT in ms Average Data Rate for First Trial 92.5 Mbps -Mbps RTT Average for Second Trial (10 pings) 0.13 ms Average Data Rate for Second Trial 128.0 Mbps RTT Average for Third Trial (10 pings) 0.14 ms Average Data Rate for Third Trial 110.8 Mbps 10. Also answer the following question in the pdf file: Compared to the times measured in Programming Assignment 2 using TCP, is UDP faster or slower than TCP? Why?
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