An overview of all my projects can be found here: ahokcool
This project was created as part of my studies at: 42 Lisboa
- UNIX Signals
- C signal handling
$ git clone --recurse-submodule https://github.com/ahokcool/minitalk.git # Clone
$ cd minitalk # Change directory
$ make # Compile
$ ./server # Start server
$ ./client "Message" <PID of Server> # Send Messages
make test
To get more of an binary vibe I renamed the signals...
USR1
= BIT_0
USR2
= BIT_1
Step | Client->Server | Server->Client |
---|---|---|
say hello | BIT_0 |
BIT_0 |
ur ready server? | BIT_1 (each second) |
BIT_1 (if ready) |
send message literally 'bit by bit' (waiting for an answer after each bit) |
BIT_0 (if bit of current char is 0)BIT_1 (if bit of current char is 1) |
BIT_0 (to confirm the reception) |
send and additional /0 to indicate the end of the message |
BIT_0 (8 times) |
BIT_1 |
☝️only if all characters of the message have been transmitted and the client recives the BIT_1
signal from the server it prints SUCCESS
!
This allows multiple clients to connect to the server at the same time: