From 032d5a94d803ee313076bf465ca8d12a19d98201 Mon Sep 17 00:00:00 2001 From: Harry Parkes Date: Tue, 19 Nov 2024 12:06:46 +1300 Subject: [PATCH] Updated readme for new functionality --- README.md | 49 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 2c346a6..d70da8d 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,75 @@ # Socket Programming + ![unittests passing](https://github.com/hazzery/socket-programming/actions/workflows/unittests.yml/badge.svg) [![codecov](https://codecov.io/gh/hazzery/socket-programming/graph/badge.svg?token=6GQA3I43XT)](https://codecov.io/gh/hazzery/socket-programming) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/hazzery/socket-programming/master.svg)](https://results.pre-commit.ci/latest/github/hazzery/socket-programming/master) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/) -# Usage Instructions +## Usage Instructions To start the server program, execute the following command in the project directory. + ```bash python3 -m server ``` + This starts up a welcoming socket, which listens for client connections on the specified `port_number` for incoming connections. +To send and read messages, you must execute the client program using the +following command. -To send and read messages, you must execute the client program using the following command. ```bash -python3 -m client +python3 -m client ``` -Here, `server_address` is the IP address of the computer in which the server program is running on, -`port_number` is the port number on which the server program is listening for incoming connections, -`username` is the name of the client connecting to the server, and `message_type` is the type of -request to send to the server. This can be either `create` to send somebody a message, -or `read` to receive messages that have been sent to you. -Upon making a Create request, you will be prompted to enter the name of the -recipient of your message, and the message you would like to send them. +Here, `server_address` is the IP address of the computer in which the server +program is running on, `port_number` is the port number on which the server +program is listening for incoming connections, `username` is the name of the +client connecting to the server. + +Running the client will prompt you to input the name of the request you wish to +perform. + +- `register` sends your name and randomly generated RSA public key to the server +- `login` has the server generate you a session token used to validate requests +- `key` requests another user's public key so you can send them messages +- `create` to send somebody a message +- `read` to receive messages that have been sent to you. + +Note: All request names are case-insensitive, so can be capitalised if you like + +Upon making a create, you will be prompted to enter the name of the recipient +of your message, and the message you would like to send them. Making a key +request will prompt you to enter the name of the user whose key you want. ## Example Usage + ### Server + ```bash python3 -m server 12000 ``` ### Client 1 + ```bash -python3 -m client localhost 12000 Alice create +python3 -m client localhost 12000 Alice +create John Hello John! How are you? ``` ### Client 2 + ```bash -python3 -m client localhost 12000 John read +python3 -m client localhost 12000 John +read ``` -# Licence +## Licence + This project is licenced under the GNU AGPL version 3 ![AGPLv3](https://www.gnu.org/graphics/agplv3-with-text-162x68.png)