This is a sample/starter code for some programming assignments in the Distributed Systems course taught by Prof. Fábio M. Costa at UFG in 2022. The app implements a simple client-server architecture where students can identify limitations, problems, and make enhancements at various levels, including architectural, non-functional aspects, and functional aspects.
The Chat-Sample-App follows a basic client-server architecture. The server acts as a central point for message relaying between clients. Each client can send messages to other clients via the server.
The Chat-Sample-App provides the following functionality:
-
User Registration: Users can register their names along with their IP addresses and port numbers in the
const.pyfile. -
Sending and Receiving Messages: Clients can send messages to other clients by specifying the destination username. The server relays the messages to the appropriate clients.
-
Dynamic User Addition: If a user attempts to connect with a name that doesn't exist in the
const.pyregistry, the app prompts the user to provide the IP address and port number for the new user. The information is then added to the registry. -
Concurrent Message Handling: The app utilizes threads to handle multiple client connections simultaneously. Each client connection is handled in a separate thread to allow concurrent message sending and receiving.
To use the Chat-Sample-App, follow these steps:
- Clone the repository:
git clone https://github.com/your_username/Chat-Sample-App.git - Navigate to the project directory:
cd Chat-Sample-App - Configure the
const.pyfile: Update theregistrydictionary with the desired usernames, IP addresses, and port numbers. - Start the server: Run the server code using
python3 server.py. - Start a client: Run the client code using
python3 client.py <Username>, where<Username>is the desired username for the client. - Interact with the client: Use the command-line interface to enter the destination username and message. Follow the prompts for further actions.
Here are a few examples of how to use the Chat-Sample-App:
-
Registering a New User:
- If the user attempts to connect with a username that doesn't exist in the
const.pyregistry, they will be prompted to enter the IP address and port number for the new user. - The registry will be updated with the new user's information, allowing future connections using the new username.
- If the user attempts to connect with a username that doesn't exist in the
-
Sending Messages:
- When prompted, enter the destination username and message.
- The message will be sent to the server and relayed to the appropriate client.
-
Exiting the App:
- To exit the app, either enter "exit" as the destination username or when prompted to enter the destination username.
Contributions to the Chat-Sample-App are welcome. You can enhance the app by addressing limitations, improving non-functional aspects, or adding new functionality. Feel free to create pull requests with your enhancements.
This project is licensed under the MIT License.
Antonio Emilio - 201905481 Melyssa Mariana - 201905503
