How laufari/minitalk works
Project type and purpose
• This is a lightweight C-based IPC tool (“Minitalk”) that implements a custom bit-level messaging protocol over UNIX signals (SIGUSR1 = bit0, SIGUSR2 = bit1).
• Purpose: client sends a string to server by encoding each character’s bits into signals; server rebuilds the characters, prints them (via ft_printf), and optionally acknowledges each bit.
File structure
• Top–level sources:
• client.c / client.h → client process
• server.c / server.h → server process
• ft_memcpy.c → memory helper
• ft_printf/… → custom printf library (Makefile + source files)
• Build: single Makefile compiles all sources into two executables (client, server).
• No external services—communication happens through the kernel’s signal delivery mechanism.
README for additional insights
• Protocol: client reads server PID, loops over message characters, and for each bit invokes kill(server_pid, SIGUSR1 or SIGUSR2).
• Server prints its PID on startup, installs signal handlers (signal() or sigaction()), reconstructs bytes, prints via ft_printf, and (bonus) sends back an acknowledgment signal for each bit.
• Performance constraint: server must handle 100 chars in <1s, no memory leaks, conform to 42 school norms.
• Client Process (rectangle)
• Server Process (rectangle)
• ft_memcpy Utility (smaller module)
• Makefile (annotation)
1. Client → Kernel: kill(server_pid, SIGUSR1/ SIGUSR2) – “bit0/bit1”
2. Kernel → Server: deliver SIGUSRx → server’s signal handler
3. Server Handler → Internal Logic: accumulate bits → reconstruct char → call ft_printf
4. (Optional) Server → Kernel: kill(client_pid, SIGUSR1) – “ack”
5. Kernel → Client: deliver ACK signal → client proceeds to next bit
6. Both client & server link against ft_printf and use ft_memcpy
c. Architectural patterns & principles:
• Event-driven (async signal handlers)
• Single responsibility (client-only send, server-only receive)
• Modular library separation (ft_printf as reusable component)
• Minimal coupling (communication via OS-managed signals)
d. Key technologies & libraries:
• C standard library (kill(), signal() / sigaction())
• Custom ft_printf + ft_memcpy
• Makefile for build orchestration
Detail & granularity
• Break the client into sub-steps: message input → bit encoder → kill() calls
• Break the server into: signal handler → bit accumulator → character emitter → ft_printf call → optional ack
• Sequence numbers or timing constraints if desired (to reflect the performance goal).