▪️Understand minitalk
You will have to realize a communication program in the form of a client and a server.
Last updated
You will have to realize a communication program in the form of a client and a server.
Last updated
The goal of the Minitalk project is to develop a simple program that allows processes (= programs running on a computer) to communicate with each other using a communication protocol called "minitalk". It corresponds to the protocol that you need to code.
The minitalk communication protocol involves sending messages between two processes using a series of signals over a single wire.
One process, called the "speaker/client" sends the message by transmitting a series of signals over the wire.
The other process, called the "listener/server" receives the message by interpreting the series of signals as a message.
Signals are a form of communication between processes used by Unix-like systems (e.g. MacOS or Linux) and those respecting the POSIX standards. Signals can be defined as a message, an event or an interrupt. When a process receives a signal, the process will stop what its doing and take some action. In the context of the Minitalk project, signals are used to transmit messages between processes using the minitalk communication protocol.
I am a visual person, so I tried to make this diagram for you to understand better:
As we can see, we have a client that wants to send a message to the server. The "Hello" (message) cannot be sent directly to the server. The client has to encrypt the message and the server has to decrypt/interpret it before it can be displayed.
I'll keep it general here and go into more detail in the "Building the thing" section.
We are going to go a little further than what is asked in the subject, but it is to better understand later what you do.
Processes and signals are the most important terms to know in this project. I've already explained a bit about them above, but you may not have fully understood them yet - let's take another simple example to understand these new concepts.
As i said before, in computer science, a signal is a message that is sent to a process to indicate a particular event has occurred or to request a particular action to be taken. A process is a program that is being executed by the computer.
Let's take a simple example:
Imagine you have a program that is running on your computer. This program is Google Chrome running in the background on your computer. When you have multiple windows open on your browser, you have multiple programs running. These programs are called processes.
Now, suppose that you want to stop these program. You can do this by simply closing the browser window in question. Easy. Or by sending a signal to the process. Remember: a signal is just telling a process to do a certain thing!
Here, we want to close the windows. That will be the signal that we want to send to the processes.
For this, you might use the "kill" command in a terminal window to send a signal to the processes. This signal tells the process to terminate itself. So in this example, the signal (the "kill" command) is used to request a particular action (termination of the process) to be taken.
To send a signal to a certain process you need the PID of it. They will be useful, because that's how you will know which signal to send to which process. It's like a computerized version of our passports. Example on how to dit it:
kill <PID>
If you use the above command you will have to kill one process after the other. As they are all part of Chrome, you could also use a single command instead, which will close all running programs (processes) related to chrome.
killall chrome
Well, I hope you now have a better understanding of the basic concept! Now let's move on to the last theoretical part. To achieve this project, you will have to understand and use new functions that allow to manage these computer signals: signal(), sigemptyset(), sigaddset(), sigaction(), kill(), pause() and sleep().