This is a simple client-server communication program in C that allows the client to send a string to the server using signals. The server, upon receiving the string, will print it. The program uses the concept of signals in C for inter-process communication.
Languages
Features
- The server is started first and prints its PID upon launch.
- The client takes two parameters: the server PID and the string to send.
- The server displays the received string pretty quickly.
Resources
- https://www.qnx.com/developers/docs/6.5.0SP1.update/com.qnx.doc.neutrino_lib_ref/s/sigaction.html
- https://www.qnx.com/developers/docs/6.5.0SP1.update/com.qnx.doc.neutrino_lib_ref/s/sigaction_struct.html
Usage
- Compile and create the executables
For Bonus:
make
make bonus
- Start the server
For Bonus:
./server
./server_bonus
- Run the client by executing the client executable and passing the server PID and the string to send as arguments
For Bonus:
./client <server_pid> <string_to_send>
Example./client_bonus <server_pid> <string_to_send>
./client 12345 "Hello, server! This is a test message."
Result: 1️⃣2️⃣5️⃣ / 1️⃣0️⃣0️⃣ ✔️