Question
Write a client and server program using python. There are two clients, X and Y that will communicate with a server. Clients X and Y
Write a client and server program using python. There are two clients, X and Y that will communicate with a server. Clients X and Y will each open a TCP socket to your server and send a message to your server. The message contains the name of the client followed by your name (e.g., Client X: Alice, Client Y: Bob).
The server will accept connections from both clients and after it has received messages from both X and Y will print their messages and then send an acknowledgment back to your clients. The acknowledgment from the server should contain the sequence in which the client messages were received (X: Alice received before Y: Bob, or Y: Bob received before X: Alice). After the server sends out this message it should output a message saying - Sent acknowledgment to both X and Y. Your server can then terminate. Once your clients receive the message from the server, they should print the message that they sent to the server, followed by the reply received from the server. The following figure explains the problem.
Server Client X Client Y clientx: Alice Bob Y: client Bob Y: before received Alice X: X: Alice received before Y: Bob
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