The purpose of this project is to code a small data exchange program using UNIX signals. Therefore, the communication program between a client
and a server
has to be done using only UNIX signals. Thus, it was allowed to use only two signals: SIGUSR1
and SIGUSR2
.
The server
should be able to receive strings from several clients in a row without needing to restart. For the bonus project, the server
also acknowlegdes every message received by sending back a signal to the client
and supports Unicode characters.
git clone git@github.com:ygor-sena/42cursus-minitalk.git
make
./server
It will print something to the standard output, such as:
Server PID is: 1084.
If you want to run the program looking for memory leaks, just start it as follows:
valgrind --leak-check=full --show-leak-kinds=all ./server
It must receive the following three arguments: the executable program, the server PID and the text to be sent. For example:
./client 1024 "This is an amazing but not so long sentence, minitalk!"
After completing the four steps above, the server
will receive and print the message from client
. After the message has been fully printed, the server
will send a message back to the client
signaling that data has been successfully received. The client
will then show the following information:
1084 server PID: data received.
To send another message to the server
, the client
program must be executed once again.
-
About Unicode characters:
- The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) by Joel Spolsky.
- Unicode in C and C++: What You Can Do About It Today by Jeff Bezanson.
- Unicode character table searcher to easily get Unicode characters.
-
About signals:
- Introduction To Unix Signals Programming by Kent State University.
- signal handler sa_sigaction arguments by StackOverflow.
- How can I translate from Decimal to binary and send it with sigusr 1-2? by 42 Network StackOverflow.
-
About bit shift manipulation (this video is amazing!):
-
BRYANT, Randal; O'HALLARON, David. Computer Systems: a programmer's perspective. 3rd edition, 2016.
- Source code of the book examples: https://csapp.cs.cmu.edu/3e/code.html