2023-03-11 02:35:58 +01:00
|
|
|
# Minitalk
|
|
|
|
Minitalk is a simple project that requires you to use unix signals to send over strings between 2 programs.
|
|
|
|
We can only use **SIGUSR1** and **SIGUSR2** and we can use the kill function to send them over
|
2023-03-11 02:40:45 +01:00
|
|
|
|
2023-03-11 02:40:12 +01:00
|
|
|
---
|
2023-03-11 02:35:58 +01:00
|
|
|
## Improvements
|
|
|
|
### Add support for multiple clients at the same time
|
2023-03-11 02:42:15 +01:00
|
|
|
##### Client
|
2023-03-11 02:35:58 +01:00
|
|
|
- client pings server every 100 msecs, and only starts writing after receiving SIGUSR2 back
|
|
|
|
- client sends \0 when done
|
|
|
|
#### Server
|
|
|
|
- server waits for a signal when pid = 1
|
|
|
|
- when server receives signal it sets the pid to the sender pid
|
|
|
|
- it keeps ignoring signals from other PIDs untill it received \0 from the current pid
|
|
|
|
- after \0 is received pid is set back to 1
|
2023-03-11 02:41:34 +01:00
|
|
|
|
2023-03-11 02:44:20 +01:00
|
|
|
---
|
|
|
|
## Bugs
|
|
|
|
*none*
|
2023-03-11 03:17:25 +01:00
|
|
|
~~pid would return 0 when run in background~~
|
|
|
|
|
|
|
|
---
|
|
|
|
## Usage
|
|
|
|
1. Simply clone or download the repository
|
|
|
|
2. Run `make` in the cloned directory
|
|
|
|
3. Start the server with `./server` in the cloned directory
|
|
|
|
4. Open a second terminal in the same directory and run `./client [PID from server] ["Message in quotes"]`
|
2023-03-11 02:44:20 +01:00
|
|
|
|
2023-03-11 02:41:34 +01:00
|
|
|
---
|
2023-03-11 02:35:58 +01:00
|
|
|
## Tester
|
|
|
|
- add valgrind to tester
|
|
|
|
- check for -Wall -Werror -Wextra
|
2023-03-11 02:44:20 +01:00
|
|
|
|
2023-03-11 03:17:25 +01:00
|
|
|
#### Usage
|
|
|
|
1. Download test.sh into your own minitalk directory
|
|
|
|
2. Make the file executable `chmod +x test.sh`
|
|
|
|
3. Run `./test.sh` to start the test
|
|
|
|
|
2023-03-11 02:44:20 +01:00
|
|
|
---
|
2023-03-11 02:50:33 +01:00
|
|
|
[This project is part of the studies at 42](https://42.fr/en/homepage/)
|
2023-03-11 02:44:20 +01:00
|
|
|
|
|
|
|
![alt text](https://www.markdownguide.org/assets/images/tux.png)
|
|
|
|
|
|
|
|
| Syntax | Description |
|
|
|
|
| ----------- | ----------- |
|
|
|
|
| Header | Title |
|
|
|
|
| Paragraph | Text |
|
|
|
|
|
|
|
|
```
|
|
|
|
|
2023-03-11 03:17:25 +01:00
|
|
|
```
|
2023-03-11 02:45:21 +01:00
|
|
|
|
|
|
|
> blockquote
|