subject

For the ping_client python program, you need to write the program to fulfill the following functionalities. (Python program) Send 10 ping request message using UDP protocol to server
Print the response message from server as shown in the example section, the client program will wait up to 0.5 seconds for server response
If server response is received within 0.5 seconds, print the ping echoed message and the calculated round-trip time (RTT) in seconds
If no response is received with 0.5 seconds, print the message ping request message and "Time out"
For the ping_server python program, most of the code have been provided as follows, you need to work on the following
Finish the fill in section so that the ping echoed message is created as shown in the testing section.
The ping echoed message is generated by having the random number attached at the end of the ping request message and capitalize the whole message.
The server program simulates data loss for UDP protocol by using a random number for each ping request. A random number is chosen from the range [0, 9), if the selected number is less than 4, the server does not respond which simulates a time out event, otherwise, the server responds with the ping echoed message as specified.
# ping_server. py
# We will need the following module to generate randomized lost packets import random
from socket import *
# Create a UDP socket
# Notice the use of SOCK_DGRAM for UDP packets
serverSocket = socket(AF_INET, SOCK_DGRAM)
# Assign IP address and port number to socket
serverSocket. bind(('', 12000))
while True:
# Generate random number in the range of 0 to 10
rand = random. randint(0, 10)
# Receive the client packet along with the address it is coming from
message, address = serverSocket. recvfrom(1024)
# Concatenate the random number to the message from the client and capitalize the message
Fill in Start
Fill in End
# If rand is less is than 4, we consider the packet lost and do not respond if rand < 4:
continue
# Otherwise, the server responds
serverSocket. sendto(message, address)

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 05:00
Modern businesses use different technologies to accomplish work tasks
Answers: 2
question
Computers and Technology, 23.06.2019 00:30
Write the html code to make a link out of the text “all about puppies”. it should link to a pdf called “puppies.pdf” inside the “documents” folder. the pdf should open in a new window.
Answers: 2
question
Computers and Technology, 23.06.2019 13:30
Spoons are designed to be used for: spring hammering. applying body filler. identifying high and low spots. sanding highly formed areas.
Answers: 3
question
Computers and Technology, 23.06.2019 21:30
Write a fragment of code that reads in strings from standard input, until end-of-file and prints to standard output the largest value. you may assume there is at least one value. (cascading/streaming logic, basic string processing)
Answers: 3
You know the right answer?
For the ping_client python program, you need to write the program to fulfill the following functiona...
Questions
question
Mathematics, 28.09.2020 05:01
question
Mathematics, 28.09.2020 05:01
question
Engineering, 28.09.2020 05:01
question
Mathematics, 28.09.2020 05:01
question
Chemistry, 28.09.2020 05:01
question
Mathematics, 28.09.2020 05:01
Questions on the website: 13722362