Git Product home page Git Product logo

42minitalk's Introduction

πŸ“— 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

42minitalk's People

Contributors

realconrad avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.