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 20:40
Assume that there is a 4% rate of disk drive failure in a year. a. if all your computer data is stored on a hard disk drive with a copy stored on a second hard disk drive, what is the probability that during a year, you can avoid catastrophe with at least one working drive? b. if copies of all your computer data are stored on three independent hard disk drives, what is the probability that during a year, you can avoid catastrophe with at least one working drive?
Answers: 1
question
Computers and Technology, 23.06.2019 11:00
What are the possible consequences of computer hacking? what is computer piracy? describe some examples. what are the effects of computer piracy? what are the possible consequences of computer piracy? what is intentional virus setting? describe some examples. what are the effects of intentional virus setting? what are the possible consequences of intentional virus setting? what is invasion of privacy? describe some examples. what are the effects of invasion of privacy? what are the possible consequences of invasion of privacy? what is an acceptable use policy and what is the purpose of the acceptable use policy what is intellectual property and how can you use it?
Answers: 1
question
Computers and Technology, 24.06.2019 14:40
Create a function (prob3_6) that will do the following: input a positive scalar integer x. if x is odd, multiply it by 3 and add 1. if the given x is even, divide it by 2. repeat this rule on the new value until you get 1, if ever. your program will output how many operations it had to perform to get to 1 and the largest number along the way. for example, start with the number 3: because 3 is odd, we multiply by 3 and add 1 giving us 10. 10 is even so we divide it by 2, giving us 5. 5 is odd so we multiply by 3 and add one, giving us 16. we divide 16 (even) by two giving 8. we divide 8 (even) by two giving 4. we divide 4 (even) by two giving 2. we divide 2 (even) by 2 to give us 1. once we have one, we stop. this example took seven operations to get to one. the largest number we had along the way was 16. every value of n that anyone has ever checked eventually leads to 1, but it is an open mathematical problem (known as the collatz conjectureopens in new tab) whether every value of n eventually leads to 1. your program should include a while loop and an if-statement.
Answers: 3
question
Computers and Technology, 24.06.2019 17:40
File i/o activity objective: the objective of this activity is to practice working with text files in c#. for this activity, you may do all code in the main class. instructions: create an app that will read integers from an input file name numbers.txt that will consist of one integer per record. example: 4 8 25 101 determine which numbers are even and which are odd. write the even numbers to a file named even.txt and the odd numbers to a file named odd.txt.
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, 13.05.2021 17:00
question
Arts, 13.05.2021 17:00
question
Arts, 13.05.2021 17:00
question
Mathematics, 13.05.2021 17:00
question
Mathematics, 13.05.2021 17:00
Questions on the website: 13722360