Overview
Minitalk is a simple client-server communication program that uses UNIX signals (SIGUSR1 and SIGUSR2) to transmit messages between processes. This guide will help you get from zero to sending your first message.Minitalk works by encoding each character as a sequence of bits and sending them via signals. The server receives these signals and reconstructs the original message.
Prerequisites
Before you begin, ensure you have:- A Unix-based operating system (Linux or macOS)
- GCC compiler installed
- Make build tool installed
Build the Project
Build both the server and client executables using make:This will compile:Available make commands:
server- The server executable that receives messagesclient- The client executable that sends messages
The Makefile uses gcc with
-Wall -Wextra -Werror flags to ensure code quality. The build includes the custom libft library with ft_printf implementation.Start the Server
In your first terminal window, start the server:The server will display its Process ID (PID) and wait for messages:
Send Your First Message
Open a new terminal window in the same directory. Use the client to send a message to the server:Replace The message will appear in the server’s terminal window as it receives each character.
<PID> with the actual Process ID shown by the server.Example:The client sends each character bit-by-bit using SIGUSR1 (for 0) and SIGUSR2 (for 1). There’s a 700 microsecond delay between each bit to ensure reliable transmission.
Usage Examples
Here are some common usage patterns:Expected Output
Server Terminal
Client Terminal
The client exits silently after successfully sending the message. If there’s an error, you’ll see one of these messages:How It Works
- Server starts and registers signal handlers for SIGUSR1 and SIGUSR2
- Client takes a PID and message as arguments
- Client converts each character to binary (8 bits)
- Client sends each bit as a signal:
- SIGUSR1 = bit value 0
- SIGUSR2 = bit value 1
- Server receives signals and reconstructs bits into characters
- Server prints each character when it receives all 8 bits
Troubleshooting
Wrong PID error
Wrong PID error
Make sure you’re using a valid numeric PID from the server output. The PID must contain only digits.
Client failed sending signal
Client failed sending signal
This usually means the server process doesn’t exist or you don’t have permission to send signals to it. Verify:
- The server is still running
- You’re using the correct PID
- The server process belongs to your user
Compilation errors
Compilation errors
Ensure you have gcc installed and all source files are present:
server.cclient.clibft/directory with utility functions
Server not receiving messages
Server not receiving messages
Check that:
- The server is running and hasn’t crashed
- You’re using the correct PID
- There’s no firewall blocking signals (rare on local system)
Next Steps
Now that you have Minitalk running:- Try sending longer messages to see the character-by-character transmission
- Experiment with different types of content (numbers, special characters, etc.)
- Review the Client-Server Architecture to understand the signal-based communication
- Check out the API Reference for detailed function documentation