Go to file
Lachlan Slape b90cc57872
add tests
2023-11-02 12:28:58 +10:00
.vscode configs and basic client connections 2023-04-07 13:46:43 +10:00
server fixes for spec 2023-04-19 14:23:35 +10:00
tests add tests 2023-11-02 12:28:58 +10:00
.gitignore moved everything to seperate files 2023-04-11 10:59:59 +10:00
.pylintrc moved everything to seperate files 2023-04-11 10:59:59 +10:00
__init__.py moved everything to seperate files 2023-04-11 10:59:59 +10:00
chatclient.py fixes for spec 2023-04-19 14:23:35 +10:00
chatserver.py fixes for spec 2023-04-19 14:23:35 +10:00
configfile configs and basic client connections 2023-04-07 13:46:43 +10:00
constants.py shrink header to 5 bytes for better handling 2023-04-19 11:04:52 +10:00
readme.txt make updating username a message 2023-04-18 21:45:11 +10:00

readme.txt

# COMS3200 A1

Note: full function definitions are with the code itself.

## Assumptions Made
1. When a message is sent from a client, the client does not recieve it's own
   message back
2. Username and any other arguments do not contain spaces
3. There are no restrictions on warnings (e.g. I have logged an error when
   there is no config file specified)

## chatclient.py
This is the client that connects to the specified channel.
It does not contain a lot of logic besides sending an receiving messages.
Most of the functionality is done on the server.

The receiving messages are handled on a seperate thread.
This is to prevent thread locking.
The input is handled on the main thread.

### Function/Class Descriptions
- ChatClient: a class representing the chat client
- ChatClient._connect: sets up the connection to the channel and connects
- ChatClient._receive: retrieves messages from the socket and prints it to the
                       server's stdout
- ChatClient.start: starts the client, takes the user's input and sends it to
                    the server
- validate_arguments: makes sure the given arguments are correct

## chatserver.py
This is the server that hosts the channels for the clients to connect to.
Server-side commands (i.e. the commands executed in the cli) are processed
through the main thread.
Each channel gets it's own thread, to allow simultanously handling each
channel.
Each client also gets it's own thread.
In hindseight this is probably not a good idea, but as this is a small
project I didn't change this.

The channel and the (connecting) client are handled through classes for the
sake of modularity and not needing as many arguments.
The same is true for commands, though this was not really that necessary.

The username is set to "Anonymous" by default.
It is up to the client to authenticate with a username.
This is done by sending a packet containing the username after the user is
connected.
This also allows the user to change their username if a command is implemented.