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 19:10
What a backup plan that you have created in a event you encounter a situation
Answers: 2
question
Computers and Technology, 23.06.2019 13:30
Select the correct answer from each drop-down menu. which types of computer networks are bigger as well as smaller than a man? a man is a network of computers that covers an area bigger than a , but smaller than a .
Answers: 1
question
Computers and Technology, 23.06.2019 18:30
List 3 items that were on kens resume that should have been excluded
Answers: 1
question
Computers and Technology, 24.06.2019 16:30
The database design steps are listed below in the incorrect order. choose the correct order number next to each step. determine the information to be stored in the database. determine the fields needed to record the data determine if there will be any repetition of data entered, and separate the fields into tables to normalize the data. create relationships to connect the tables.
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, 22.04.2020 03:56
question
French, 22.04.2020 03:56
question
English, 22.04.2020 03:56
Questions on the website: 13722363