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 16:20
Consider the following statements, then select one of the answers below: the signal() function shown below registers "sig_handler()" as the signal handler function for the sigkill signal, without the complexity of using when the sigkill signal is sent to a process running this code, by a user typing "kill -kill ", where the correct process id is used for to target the process, sig_handler() will be executed.
Answers: 1
question
Computers and Technology, 23.06.2019 13:30
Best laptops for college [$100-$500 range]?
Answers: 2
question
Computers and Technology, 23.06.2019 16:30
Which of the following is not an enhancement to the standard wiki to make it more attractive for corporations? encryptionwork spacespermission toolspredictive text
Answers: 2
question
Computers and Technology, 24.06.2019 00:00
For the following example of making a peanut butter and jelly sandwich, identify which are inputs, processes, or outputs: bread scooping and spreading peanut butter plate scooping and spreading jelly finished sandwich putting two pieces of covered bread together dirty plate crumbs
Answers: 2
You know the right answer?
For the ping_client python program, you need to write the program to fulfill the following functiona...
Questions
question
Arts, 25.11.2020 05:40
question
Health, 25.11.2020 05:40
question
History, 25.11.2020 05:40