Skip to content

This project implements a simple messaging system with a server and client in Python. The system allows users to create accounts, send messages, and manage their inbox.

License

Notifications You must be signed in to change notification settings

chatzianagnostis/Messaging-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Messaging System

Introduction

This project implements a simple messaging system with a server and client in Python. The system allows users to create accounts, send messages, and manage their inbox.

Prerequisites

  • Python 3

Files

  • server.py: Contains the implementation of the messaging server.
  • client.py: Implements a client to interact with the messaging server.

Classes

Account

Represents a user account with a username and authentication token.

MessagingServer

Implements the messaging server, allowing account creation, message sending, and inbox management.

MessagingClient

A client interface to interact with the messaging server. Provides methods to create accounts, send messages, and manage the inbox.

Usage

Running the Server

  1. Open a terminal.
  2. Navigate to the directory containing Server.py.
  3. To run the server, use the following command:
python server.py <port_number>

Replace <port_number> with the desired port.

Running the Server

  1. Open a new terminal.
  2. Navigate to the directory containing Client.py.
  3. Run the following commands
  • Create Account (Function ID: 1)
python client.py <server_ip> <server_port> 1 <username>

Creates an account for the user with the specified username and returns a unique authentication token.

  • Show Accounts (Function ID: 2)
python client.py <server_ip> <server_port> 2 <authToken>

Displays a list of all accounts in the system.

  • Send Message (Function ID: 3)
python client.py <server_ip> <server_port> 3 <authToken> <recipient> <message_body>

Sends a message to the specified recipient.

  • Show Inbox (Function ID: 4)
python client.py <server_ip> <server_port> 4 <authToken>

Displays a list of all messages in the user's inbox.

  • Read Message (Function ID: 5)
python client.py <server_ip> <server_port> 5 <authToken> <message_id>

Displays the content of a specific message and marks it as read.

  • Delete Message (Function ID: 6)
python client.py <server_ip> <server_port> 6 <authToken> <message_id>

Deletes a specific message from the user's inbox.

Examples

Server

python server.py 5000

Client

Create Account

python client.py localhost 5000 1 demouser

Show Accounts

python client.py localhost 5000 2 <authToken>

Send Message

python client.py localhost 5000 3 <authToken> friend "Hello, friend!"

Show Inbox

python client.py localhost 5000 4 <authToken>

Read Message

python client.py localhost 5000 5 <authToken> 1

Delete Message

python client.py localhost 5000 6 <authToken> 1

Make sure to replace <server_ip>, <server_port>, <authToken>, <username>, <recipient>, <message_body>, and <message_id> with the appropriate values.

Notes

  • Ensure that the server is running before attempting to use the client.
  • The provided examples assume the server is running on localhost and port 5000. Adjust the parameters accordingly based on your setup.

About

This project implements a simple messaging system with a server and client in Python. The system allows users to create accounts, send messages, and manage their inbox.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages