Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part 1 b - Server: Write a server program in Python 3 using the sockets module that receives the client program's ping message, processes it
Part b Server:
Write a server program in Python using the sockets module that receives the client program's ping message, processes it and then sends it back to the client program. Your server will process one message at a time since the client will only send one message at a time
a When the server receives a message, there should be approximately a chance that the message is not sent back to the client. Basically, the server goes back to listening if the random chance hits about when receiving the message. This will simulate packet loss somewhere in the network.
NOTE: Think about the Python random module. out of ; out of ; out of ; out of
b The server will change the "ping" portion of the received message to "pong" and will NOT change anything else of the original message. The "pong" message with then be sent back to the client for processing of the roundtrip time RTT Example message received by server from client and the server response are as follows:
server receives message: ping :: Jan
server sends message: pong :: Jan
NOTE: The ping counter value, date, and time information is NOT changed.
Server HINT: It is not a requirement that the server display anything, however, I suggest that you display a message indicating that the server program is running. It may also help if you display received and sent messages. This will help with confirming you are receiving, processing, and sending the message formatted correctly.
Part b Testing:
Assuming your client is working as specified above, you can test your server by having your client connect to it on the loopback address, dont hard code this in If you had issues getting your client to work correctly, we will provide you a working client program that you can use to test after the Part submission has concluded. More information on this will be provided as we get closer to Part
Part b Hints:
Look at the provided client code and think about how you would modify it to receive a message, modify the message, and send that message back.
What do you need to do to ensure that there is a chance that a message is dropped by the server? We recommend looking into the random module.
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