Commit ef90c58a authored by TheLostWanderer's avatar TheLostWanderer
Browse files

update README.md

parent 417d6708
# TCP Client & Server - C
## Presentation
Small server which sends back the text received from the client.
## How to use
```
$ ./release/server.bin <port number>
```
```
$ ./release/client.bin <ip address> <port number>
```
## How to compile
In the folder of the project:
```
make
```
## Rational
I started this project to revise different concepts in C such as sockets,
semaphores and threads.
I decided to switch to C when I realised how low-level this project consisted in.
# Documentation
## File Architecture
```
$ tree -d
.
├── include ## Header files
└── src ## Source files used in both binaries
├── client ## Source files specific to the client
└── server ## Source files specific to the server
```
## Code Architecture
```
+-------------------+ +-------------------+
| | | |
| Server | | Client |
| | | |
+---------+---------+ +---------+---------+
| |
| |
| | <-----+ User Input
Read XX XX
|XX XX |
+------+ | XXXXXXXXXXXXXXXXXXXXXXXXX |
| Copy | Socket |
+------> | XXXXXXXXXXXXXXXXXXXXXXXXXX |
XXX XXX
Send back | |
| | +-----> Display text
| |
+ +
```
## Chronogram of the server's threads
This section is clearly over-engineered in respect to its function, but it
had the purpose of implementing threads and semaphores.
- The first `Reading` thread reads the sockets and copy the text received.
- The second `Copying` thread copies the char array stored by the previous
thread and copy its content.
- The third `Writing` thread checks if there is text to be sent, and if so,
sends it in the socket.
```
+----------------+ +----------------+ +----------------+
| | | | | |
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment