Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
1. Assignment Overview
The goal of this assignment is to gain hands-on experience programming with sockets and transport protocols (TCP and UDP). You will implement a simple name guessing game using socket programming in Python to send and receive messages between a client program and a server program.
2. Project Description
The project3_skeleton.zip file is provided to you. It contains:
Your job is to complete the skeleton code in server.py and client.py to successfully play a simple name guessing game. (The game implementation is mostly done for you, so you need to mainly focus on sending messages back and forth using TCP and UDP sockets).
The idea is the client will contact the server by sending a datagram message using UDP announcing itself to the server. The server responds with the TCP port the client should use for further communication. Finally, send game messages back and forth using TCP. The client repeatedly guesses names by sending them to the server. The backend (server) handles the game logic. When a new game is started a random name is generated. The player will try to guess the name. If the name is two high (later alphabetically), the game will say that the guess was too high. If the guess was too low, the game will say that as well. If the guess was too short (too few letters) or too long, the game will say that as well. by checking the guess and indicating of the guess. It also decrements the number of attempts left in the case of an incorrect or already guessed name. The skill level of the game can also be set between 1 and 8. This determines what the maximum number of letters in the name and the number of guesses that are available to the player.
If the guess is wrong, display one of the following messages on the client:
Too high means you are too high alphabetically.
Each message consists of a message type followed by any message parameters. The message type is separated from the parameters by a space character. Each message ends with a newline character. (Remember TCP is a stream protocol and does not have the concept of messages. So the application must define what makes up a message.) The message type will dictate to each program what to do next (this is outlined in Section 6 below). An example exchange of game messages is shown in Figure 1 for your reference.
You should modify the README.txt with your information, the machines you tested your programs on, a list of resources you used, additional comments, and some sample test output from your programs (both client and server).
The client should accept two command line arguments:
When the client is first started it should prompt the user for their name. After the user has entered their name, the client should send a datagram containing the hello message with the user’s name. It should then wait for a return datagram from the server. This datagram will contain a port TCP message. The client should add a timeout value on the UDP socket so that if a server does not respond to the hello request the client can send the message again. This time out should be set to 30 seconds. If the request times out, the client should retry sending the hello message up to 3 times before giving up. Each time the client retries sending the hello message, it should display the following message to the player:
No Response from the Server, retrying…
If after 3 tries, the server still has not responded, the player should see the following message:
No Response from the Server, please try again later.