Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

server.py & client.py Problem Statement: 1 . Concurrent Client Management: Upgrade the server code to handle multiple clients simultaneously. To manage concurrency effectively, utilize either

server.py & client.py
Problem Statement:
1. Concurrent Client Management: Upgrade the server code to
handle multiple clients simultaneously. To manage
concurrency effectively, utilize either threading
functionality or the asyncio library.
2. Multi-Player Game Functionality: Introduce a multi-player
mode utilizing any(one or more) suitable message queue
protocol. This feature will allow multiple
players(clients) to join and participate in the game
concurrently.
3. Clients Score Management [Optional Feature]: Using
Memcached library, store the winning counts of all
clients per session both in single and multi-client game
mode.
Here are the steps for initiating the game:
1. Initial Interaction:
a. Upon connection, the server will prompt the client to choose a
game mode by entering '1' for the single-player mode, '2' for
the multi-player mode, or 'exit' to terminate the session.
2. Game Mode Selection:
a. If the client selects '1', the server will initiate the
single-player game mode as developed in the earlier
assignments.
b. If the client chooses '2', the server will launch the
multi-player game mode.
c. If the client types 'exit', the server will gracefully close
the connection with the client.
Here are the detailed steps for the single-player game mode:
1. Number Selection: Once the single-player mode is chosen, the server
randomly selects a number that the client needs to guess correctly to
win.
2. Game Rules Communication: The server informs the client of the game
rules, including the maximum number of attempts allowed and the range
within which the number lies. Instructions on how to exit the game
prematurely are also provided.
3. Guessing Process: The client then submits guesses to identify the
server's chosen number, adhering to the established rules.
4. Response to Guesses:
a. If the client correctly guesses the number, the server sends a
congratulatory message and resets the game, prompting the
player to choose a game mode again.
b. If the client decides to exit by sending "exit," the server
terminates the single-player session and reverts to the initial
game mode selection.
c. If the client's guess is incorrect, the server provides a hint
indicating whether the guess was too high or too low.
5. Attempt Limit: If the client fails to guess the number within the
allowed attempts, the server sends a message indicating their failure
and restarts the game, asking the player to select a game mode again.
Here are the detailed steps for the multi-player game mode:
1. Initialization: When the multi-player mode is selected, the server
picks a random number the players must guess to win.
2. Rule Communication: The server informs all connected clients of the
game about the game rules including the range within which the number
lies, the maximum number of attempts each player has, and how to exit
the game in the middle of a session.
3. Guessing Phase: Clients attempt to guess the server's chosen number
following the specified rules.
4. Handling Correct Guesses: If a client guesses the number correctly:
a. The server sends a victory message to all participants in the
multi-player game.
b. The server then selects a new random number for the next round.
c. Attempts for all clients are reset, ensuring everyone has a
full set of new chances for the new number.
d. The server notifies all clients about the new game round, the
new number to guess (not the actual number, just that a new
number has been chosen), and refreshed attempt allowances.
5. Exiting the Game: If a client sends "exit," they are removed from the
multi-player game, and the server then prompts them to choose between
single-player and multi-player modes again.
6. Incorrect Guesses: If a client's guess is incorrect, the server sends
a hint to guide them, indicating whether the number is higher or
lower than their guess.
7. Exhausted Attempts: If no client correctly guesses the number within
the maximum allowed attempts:
a. The server sends a message to all clients stating that the
attempts have been exhausted without a correct guess.
b. The server then chooses a new number and resets everyone's
attempt count, starting a new round.
c. Clients are notified about the new game setup and the refreshed
number of attempts.
Requirements:
1. Server-Client Communication:
a. Implement a server that can handle multiple clients
at a time.
2. Data Handling:
a. Communications between the server and the client
should be serialized using JSON.
b. Implement error handling to manage incomplete or
improperly formatted JSON data.
3. Security Features:
a. Use SSL/TLS to secure all client and server
communications.
b. Generate your owna. Implement logging to capture important events such
as connections, discon SSL certificates for testing.
4.Logging:
a. Implement logging to capture important events such
as connections, disconnections, and errors.
+) Please refer to the imageas
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

Inference Control In Statistical Databases From Theory To Practice Lncs 2316

Authors: Josep Domingo-Ferrer

2002nd Edition

3540436146, 978-3540436140

More Books

Students also viewed these Databases questions

Question

Persuading Your Audience Strategies for

Answered: 1 week ago