Skip to content

42 Minitalk: Minitalk is a project that involves creating a client-server communication system using signals. The goal is to implement a client program that can send messages to a server program using signals, which are then displayed by the server.

License

Notifications You must be signed in to change notification settings

simon-zerisenay/42Minitalk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

42 Minitalk Project

42 Badge


GitHub code size in bytes Number of lines of code Code language count GitHub top language GitHub last commit


Score

100

Introduction


Welcome to the 42 Minitalk project! This project aims to demonstrate your understanding of interprocess communication using signals in C programming. Minitalk is a simple client-server communication system that enables the transmission of text messages between two processes through signal handling.

Objective

The primary objective of this project is to implement a client and server program that can effectively communicate with each other using signals. The client program will take a string message as input and send it to the server program, which will receive the message and display it on the standard output.

Features

Signal-Based Communication

The Minitalk project leverages signal-based communication for exchanging data between the client and server. Signals provide a lightweight and efficient mechanism for interprocess communication, making them well-suited for this task. The project demonstrates the handling of specific signals, such as SIGUSR1 and SIGUSR2, to transmit information.

Reliable Message Transmission

To ensure reliable message transmission, the implementation accounts for potential signal losses. The client program employs a bit-by-bit approach to send each character of the message, allowing the server to reconstruct the complete message accurately. Additionally, the server acknowledges successful message reception by sending a specific signal back to the client.

ASCII Encoding

The Minitalk project utilizes ASCII encoding to represent text messages. ASCII characters are widely supported and can represent various alphanumeric characters, symbols, and control characters. By using ASCII encoding, the project enables the transmission of diverse text-based content.

Bonus Feature: Acknowledgement Mechanism

As a bonus feature, the project includes an acknowledgement mechanism to enhance the communication system. After receiving each message, the server sends a signal back to the client to indicate successful reception. This mechanism provides additional reliability and allows for the implementation of error handling strategies.

Installation and Usage

To use the Minitalk project, follow these steps:

Clone the repository:

git clone https://github.com/simon-zerisenay/42Minitalk.git

Navigate to the project directory:

cd 42-minitalk

Compile the client and server programs:

make

Run the server program in one terminal window:
./server
In another terminal window, run the client program:
./client [server_pid] [message]
Replace [server_pid] with the process ID of the server. Replace [message] with the desired text message to be sent. How it Works The Minitalk project consists of two main components: the client and the server.


Client



The client program is responsible for sending the text message to the server. It takes the process ID of the server and the message as command-line arguments. The client sends the message to the server by converting each character into its binary representation and transmitting it bit by bit using signals. It handles the signal responses from the server and keeps track of the number of bits received. Once the entire message is transmitted, the client terminates.

Server


The server program waits for incoming signals from the client. It sets up signal handlers for SIGUSR1 and SIGUSR2 to process the incoming signals. The server reconstructs the message by accumulating the bits received from the client and decoding them back into characters. It displays the received message on the standard output. The server continues to listen for incoming signals indefinitely.

Example Run

To illustrate the Minitalk project in action, let's consider an example run:

Start the server program in one terminal window:

./server


The server process identification (PID) will be displayed on the screen. Open another terminal window and run the client program:

./client [server_pid] [message]


Replace [server_pid] with the PID of the server obtained in the previous step. Replace [message] with the desired text message to be sent. The client will transmit the message to the server using signal-based communication. The server will receive the message and display it on the standard output. The client program will terminate once the message transmission is complete.

Conclusion

The 42 Minitalk project provides an immersive learning experience in interprocess communication and signal handling within the context of C programming. By implementing a robust client-server communication system, you will gain valuable insights into signal-based communication, reliable message transmission, and ASCII encoding. Additionally, the bonus feature of an acknowledgement mechanism adds an extra layer of sophistication to the project.

For more detailed information and to explore the source code, please refer to the project's documentation and code files. Enjoy delving into the intricacies of interprocess communication through the Minitalk project!

About

42 Minitalk: Minitalk is a project that involves creating a client-server communication system using signals. The goal is to implement a client program that can send messages to a server program using signals, which are then displayed by the server.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published