Git Product home page Git Product logo

messaging-system's Introduction

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.

messaging-system's People

Contributors

chatzianagnostis avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.