Skip to content

Latest commit

 

History

History
81 lines (71 loc) · 2.9 KB

README.md

File metadata and controls

81 lines (71 loc) · 2.9 KB

📗 Mini Talk

A small data exchange program using UNIX signals

Developed using  


Table Of Content

Features

  • Data Transmission: Send data between processes using the signal mechanism.
  • Signal Handling: Utilize sigaction to set up custom signal handlers.
  • Bitwise Manipulation: Translate characters into binary representations for transmission.
  • Error Handling: Handles potential errors during signal transmission.

How It Works

  1. Server Initialization: The server process starts and waits for signals from the client.
  2. Data Preparation: The client process translates the data into a binary representation.
  3. Data Transmission: Each bit of the binary representation is transmitted as either a SIGUSR1 (for bit 0) or SIGUSR2 (for bit 1).
  4. Data Reception: The server receives each signal and reconstructs the original data using bitwise manipulation.
  5. Acknowledgment: Once the server successfully reconstructs a byte, it sends an acknowledgment signal back to the client.

Installation

Prerequisites

  • A UNIX-based operating system (Linux, MacOS).
  • A C compiler (e.g., gcc/cc).
  1. Clone the repository
git clone https://github.com/RealConrad/42minitalk.git
  1. Enter the directory and run make

NOTE: This repo has a git submodule of 42c-library. Running make will clone this repo for you.

cd 42minitalk
make

Usage

  1. Open a terminal and start the server.
./server
  1. Copy the PID displayed in the terminal. Once you have the server PID, you can now run the client (in another terminal):
./client [SERVER_PID] "Your message here"

Examples:

  1. Normal text:
./client [PID] "Hello World"
  1. A large message:
./client [PID] "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Mi bibendum neque egestas congue. Fermentum iaculis eu non diam phasellus. Urna et pharetra pharetra massa massa ultricies mi quis hendrerit. Volutpat maecenas volutpat blandit aliquam etiam erat. Egestas congue quisque egestas diam in arcu cursus euismod. Et odio pellentesque diam volutpat. Id cursus metus aliquam eleifend mi in nulla posuere. Nulla facilisi nullam vehicula ipsum a arcu cursus. Bibendum est ultricies integer quis auctor elit sed vulputate mi."
  1. Emoji's/Unicode characters
./client [PID] "😀 😃 😄 😁 😆 😅"
./client [PID] "私は日本語を話しています!"

License

MIT