Skip to main content

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
1

Clone the Repository

Clone the Minitalk repository from GitHub:
git clone https://github.com/ibon-ira/minitalk.git
cd minitalk
2

Build the Project

Build both the server and client executables using make:
make
This will compile:
  • server - The server executable that receives messages
  • client - 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.
Available make commands:
# Build everything
make

# Clean object files
make clean

# Remove all generated files
make fclean

# Rebuild from scratch
make re
3

Start the Server

In your first terminal window, start the server:
./server
The server will display its Process ID (PID) and wait for messages:
SUCCESS!, Server is ready :D! The PID: 12345
Waiting fot the string...
Keep this terminal open and note the PID number. You’ll need it to send messages from the client.
4

Send Your First Message

Open a new terminal window in the same directory. Use the client to send a message to the server:
./client <PID> "Your message here"
Replace <PID> with the actual Process ID shown by the server.Example:
./client 12345 "Hello, Minitalk!"
The message will appear in the server’s terminal window as it receives each character.
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:
./client 12345 "Hello World"

Expected Output

Server Terminal

SUCCESS!, Server is ready :D! The PID: 12345
Waiting fot the string...
Hello, Minitalk!
The server continuously runs and displays received messages character by character.

Client Terminal

The client exits silently after successfully sending the message. If there’s an error, you’ll see one of these messages:
Usage : ./client <PID> <string to send>
or
Wrong PID
or
Client failed sending signal

How It Works

  1. Server starts and registers signal handlers for SIGUSR1 and SIGUSR2
  2. Client takes a PID and message as arguments
  3. Client converts each character to binary (8 bits)
  4. Client sends each bit as a signal:
    • SIGUSR1 = bit value 0
    • SIGUSR2 = bit value 1
  5. Server receives signals and reconstructs bits into characters
  6. Server prints each character when it receives all 8 bits

Troubleshooting

Make sure you’re using a valid numeric PID from the server output. The PID must contain only digits.
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
Ensure you have gcc installed and all source files are present:
  • server.c
  • client.c
  • libft/ directory with utility functions
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

Build docs developers (and LLMs) love