87 lines
2.4 KiB
Markdown
87 lines
2.4 KiB
Markdown
# TP_AIPS
|
|
|
|
- Groupe : 3IR C 2023-2024
|
|
- Étudiants :
|
|
- LACAU Clement
|
|
- ALNET Paul
|
|
|
|
## Building
|
|
|
|
Compile version `X` :
|
|
|
|
```
|
|
gcc -Wall -Wpedantic tsock_vX.c -o t_sockvX
|
|
```
|
|
|
|
Or compile all versions:
|
|
|
|
```
|
|
gcc -Wall -Wpedantic tsock_v1.c -o t_sockv1
|
|
gcc -Wall -Wpedantic tsock_v2.c -o t_sockv2
|
|
gcc -Wall -Wpedantic tsock_v3.c -o t_sockv3
|
|
gcc -Wall -Wpedantic tsock_v4.c -o t_sockv4
|
|
```
|
|
|
|
Generate zip archive (replace `TP1` with relevant indication) :
|
|
|
|
```
|
|
zip LACAU-ALNET-TP1.zip tsock_v*.c README.md
|
|
```
|
|
|
|
|
|
## Running
|
|
|
|
```
|
|
usage: ./t_sockv1 <-u> [-ps] [host] <port>
|
|
parameters: host With -s, address of the host to connect to. Required with -s.
|
|
port Port to connect or bind to. Required.
|
|
options: -p Runs a TCP/UDP sink. Incompatible with -s.
|
|
-s Runs a TCP/UDP faucet. Incompatible with -p.
|
|
-u Use UDP instead of TCP. Required.
|
|
|
|
usage: ./t_sockv2 [-psu] [host] <port>
|
|
parameters: host With -s, address of the host to connect to. Required with -s.
|
|
port Port to connect or bind to. Required.
|
|
options: -p Runs a TCP/UDP sink. Incompatible with -s.
|
|
-s Runs a TCP/UDP faucet. Incompatible with -p.
|
|
-u Use UDP instead of TCP.
|
|
|
|
usage: ./t_sockv3 [-psu] [-n nb_messages] [-l mess_length] [host] <port>
|
|
parameters: host With -s, address of the host to connect to. Required with -s.
|
|
port Port to connect or bind to. Required.
|
|
options: -l mess_length Size of the messages to send. Min 5. Max 1400. Default 30.
|
|
-n nb_messages Number of messages to send. Min 1. Default 10. Ignored with -p.
|
|
-p Runs a TCP/UDP sink. Incompatible with -s.
|
|
-s Runs a TCP/UDP faucet. Incompatible with -p.
|
|
-u Use UDP instead of TCP.
|
|
```
|
|
|
|
Example usage of v3 :
|
|
|
|
```
|
|
./t_sockv3 -p -l 15 4000 # receiver
|
|
./t_sockv3 -s -l 15 localhost 4000 # sender
|
|
```
|
|
|
|
Example usage of v4 :
|
|
|
|
```
|
|
./t_sockv4 -S -r -n 20 -l 15 4000 # server receiver
|
|
./t_sockv4 -C -e -n 20 -l 15 localhost 4000 # client sender
|
|
|
|
./t_sockv4 -S -e -n 20 -l 15 4000 # server sender
|
|
./t_sockv4 -C -r -n 20 -l 15 localhost 4000 # client receiver
|
|
|
|
```
|
|
|
|
## Roadmap
|
|
|
|
- [X] tsock-v1
|
|
- [X] tsock-v2
|
|
- [X] tsock-v3
|
|
- [X] tsock-v4
|
|
- [X] server can handle multiple requests simultaneously
|
|
- [X] server doesn't stop after the connection ends
|
|
- [X] both client and server can assume sender/receiver roles
|
|
|
|
Every version is fully functional.
|