▪️Building the thing
Last updated
Last updated
What I'll do here is create for you multiple checklists, that corresponds to different part of the project and that you can follow in order to build it. All the code for my "Minitalk" is available on my Github. If you have any question on it, don't hesitate to contact me (Laura) and it would be a pleasure for me to answer all the questions you might have.
Let's go back to the chart I showed you at the very beginning.
We have a client that wants to send a message to the server. The message, "Hello" in our example, cannot be sent directly to the server. The client has to encrypt the message by sending a serie of signals (in my example I did it using bits, so 0's and 1's but if you find another method, feel free to do it) and the server has to decrypt/interpret it before it can be displayed.
Why can't you just send a message directly ? As I said before, a signal is a kind of notification that is sent to a process. In this project we will be able to use only two type of signals: SIGUSR1
and SIGUSR2
. That means that when the client sends the signal SIGUSR1
to the server process, it will take a certain action. And it will do something else when it receives the SIGUSR2 signal.
Here are two checklists to help you make your project a success:
In the "client.c" file, you will...
Encrypt the message (I did the encryption via bits)
Send the message to the server (via its PID)
Create a stop condition so that the server knows when it has finished receiving the message
In the "server.c" file, you will...
Display its PID
Create an endless loop so that the server can receive signals at any time
Receive signals
Decrypt signals
For each signal received (SIGUSR1 & SIGUSR2) it should take a certain action
Of course you will also need to do these three things:
Makefile (create the "server" and "client" executables)
Manage errors & remove all leaks
Deal with the holy norminette
And that's all. Once you really understand the concepts, you'll see that this project is very simple! So now, I'll let you try to find a solution and solve this problem... good luck!