This project demonstrates a basic client-server communication system using UNIX signals. The client sends a message to the server, and the server receives and displays the message character by character.
-
client.c
: Client implementation that takes the server's PID and a message as command-line arguments. It converts each character into bits and sends them to the server using SIGUSR1 and SIGUSR2 signals. -
server.c
: Server implementation that prints its PID, sets up signal handlers for SIGUSR1 and SIGUSR2, and displays the received characters.
Compile the client and server using the following commands:
gcc -Wall -Wextra -Werror client.c libfta/libft.a -o client
gcc -Wall -Wextra -Werror server.c libfta/libft.a -o server
- Start the server in one terminal:
./server
- Note the displayed Server PID.
- In another terminal, run the client with the server PID and a message:
./client <server_pid> "<message>"
Replace <server_pid> with the actual server PID and with the desired message.
#Terminal 1 (server)
./server
#Output: Server PID: <pid>
#Terminal 2 (client)
./client <pid> "Hive Helsinki"
The server will display each received character from the client.
- Ensure that both the client and server are compiled successfully.
- Check for error messages during compilation and execution.
- If issues persist, consider using printf instead of a custom ft_printf for debugging.
- Adjust the usleep delay in the client if needed to ensure proper signal processing.