Inter-process communication using UNIX signals
A client-server system that transmits strings between processes using only SIGUSR1 and SIGUSR2. Each character is encoded bit by bit and sent one signal at a time, with server acknowledgment for reliable delivery.
┌────────────┐ SIGUSR1 / SIGUSR2 ┌────────────┐
│ CLIENT │ ──────────────────────────▶ │ SERVER │
│ │ ◀────────────────────────── │ │
└────────────┘ SIGUSR1 (ACK) └────────────┘
- The server starts and prints its PID
- The client takes the server PID and a message as arguments
- Each character is sent as 8 bits (MSB first) using
SIGUSR1(bit 1) andSIGUSR2(bit 0) - The server acknowledges each bit with
SIGUSR1before the client sends the next - A null terminator signals end of message
make # compiles server and client
make clean # removes .o files
make fclean # removes .o files and binaries
make re # full recompile# Terminal 1 — start the server
./server
# Output: Server PID: 12345
# Terminal 2 — send a message
./client 12345 "Hello from minitalk!"The server prints the received message character by character.
- Bit-by-bit transmission using only UNIX signals
- Server-to-client acknowledgment (no data loss)
- Timeout handling if server doesn't respond
- Supports full ASCII character set
- Uses
sigactionwithSA_SIGINFOfor reliable signal handling
| Component | Description |
|---|---|
| Encoding | 8-bit binary, MSB first |
| Signals used | SIGUSR1 (bit 1), SIGUSR2 (bit 0) |
| Acknowledgment | Server sends SIGUSR1 back after each bit |
| Error handling | Timeout after failed ACK, invalid PID detection |
Developed as part of the 42 Madrid curriculum. The project focuses on UNIX signals, process communication, and bitwise operations in C.