Minitalk is a C programming project that uses Unix signals to create a basic messaging system. It allows two programs, a "client" and a "server," to communicate by sending messages encoded as signals.
- Signals in Unix systems.
- Using functions from
<signal.h>:sigemptyset(),sigaddset(),sigaction(),getpid(), andkill(). - Working with
pause()andusleep()for handling signals effectively.
- Using functions from
- Bitwise operations.
- Encoding and decoding integers or characters into binary for signal-based messaging.
- Dynamic memory management.
- Using
malloc()andfree()to create a dynamic buffer. - Implementing a custom version of
realloc()for efficient memory management.
- Using
- Error handling.
- Designing an error-handling system that uses
exit()with unique error codes for various potential issues. - Ensures the program is easier to debug.
- Designing an error-handling system that uses
hive-core-minitalk/
│
├── ft-printf/ # Static library for custom ft_printf()
│ ├── ft_printf.c
│ ├── ft_printf.h
│ ├── ...
│ └── Makefile
│
├── include/minitalk_utils.h # Header files
├── src/
│ ├── minitalk-utils/ # Support functions
│ │ ├── ft_realloc.c
│ │ ├── kill_safe.c
│ │ └── sigaction_init.c
│ ├── client.c # Client programme
│ └── server.c # Server programme
│
├── test/
│ └── minitalk_test.sh # Bash script for testuing
│
├── Makefile # Building project tool
├── README.md # Instractions
├── .gitignore
└── LICENSE- Clone the repository.
git clone https://github.com/ipersids/hive-core-minitalk.git
cd hive-core-minitalk- Build the programme.
Use the Makefile to compile the source files, thelibftprintfstatic library, and create the "server" and "client" executables.
make allOther commands:
make allwill build static library and two programmes./serverand./client.make cleanwill remove all .o' files from the directory.make fcleanwill remove all .o' and executable files.make rewill trigger thefcleancommand and rebuild the mandatory functions.
-
Run the Server.
Execute the./serverfile in the terminal. It will display thePIDnumber, which is required to use the./clientprogram. -
Run the Client. Open a second terminal and run the
./clientprogram as follows:
./client <PID> <message>
# Example: ./client 89456 Hello!Developed by Julia Persidskaia.
LinkedIn