Answered step by step
Verified Expert Solution
Link Copied!

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 1b - Server:
Write a server program in Python 3 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 30% chance that the message is not sent back to the client. Basically, the server goes back to listening if the random chance hits about 30% when receiving the message. This will simulate packet loss somewhere in the network.
NOTE: Think about the Python random module. 3 out of 10;30 out of 100;300 out of 1000 ; 3000 out of 10,000.
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 round-trip time (RTT). Example message received by server from client and the server response are as follows:
, server receives message: ping 41010:43:57 Jan 2023
, server sends message: pong 41010:43:57 Jan 2023
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 1b - 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, 127.0.0.1(don't 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 1 submission has concluded. More information on this will be provided as we get closer to Part 2.
Part 1b - 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 30% chance that a message is dropped by the server? We recommend looking into the random module.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago