Skip to content

Multi-protocol C system for managing an atomic warehouse and molecule delivery, including TCP, UDP, Unix Domain Sockets clients, and a concurrent server with persistent inventory.

License

Notifications You must be signed in to change notification settings

Raz99/Atom-Molecule-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Atom & Molecule Management System

Overview

This C-based project implements a multi-protocol, concurrent system for managing an atomic warehouse and molecule delivery.
It integrates both server and client programs, supporting TCP, UDP, Unix Domain Sockets, keyboard input, startup options, and file-based inventory persistence.

Main Capabilities:

  • Multi-protocol communication: TCP, UDP, and Unix Domain Sockets (stream & datagram).
  • Concurrent request handling from multiple clients and local console.
  • Inventory management for atoms (Hydrogen, Oxygen, Carbon) and molecule delivery (Water, CO₂, Glucose, Ethanol).
  • Drink generation from predefined recipes (Soft Drink, Vodka, Champagne).
  • Configurable startup parameters (initial inventory, ports, timeout).
  • Persistent inventory storage via shared memory and file mapping.

Project Layout

atom-molecule-system/
├─ server/
│  └─ drinks_bar.c           # Central server with console interface
├─ clients/
│  ├─ atom_supplier.c        # TCP client for adding atoms
│  └─ molecule_requester.c   # UDP client for molecule requests
├─ Makefile
├─ README.md
├─ requirements.txt
├─ .gitignore
└─ LICENSE

Installation

Prerequisites

  • GCC compiler
  • POSIX-compliant OS (Linux recommended)
  • Make utility
sudo apt install build-essential

Build & Run

Compile All

make

Build Targets

  • drinks_bar – server application (with console interface)
  • atom_supplier – TCP client to add atoms
  • molecule_requester – UDP client to request molecule deliveries

Run Examples

Server

./server/drinks_bar -t 60 -T 5555 -o 12 -U 7777 -f inventory.dat

Atom Supplier (TCP client)

./clients/atom_supplier -h 127.0.0.1 -p 5555
ADD CARBON 10
ADD OXYGEN 5
ADD HYDROGEN 20

Molecule Requester (UDP client)

./clients/molecule_requester -h 127.0.0.1 -p 7777
DELIVER WATER 3
DELIVER GLUCOSE 2

Example Commands Accepted by the Server

From Atom Supplier (TCP)

ADD CARBON <number>
ADD OXYGEN <number>
ADD HYDROGEN <number>

From Molecule Supplier/Requester (UDP)

DELIVER WATER <number>
DELIVER GLUCOSE <number>
DELIVER ALCOHOL <number>
DELIVER CARBON DIOXIDE <number>

From Console

GEN SOFT DRINK
GEN VODKA
GEN CHAMPAGNE

Technologies Used

  • C (POSIX Sockets, File I/O, getopt, mmap, alarm)
  • TCP/UDP Networking
  • Unix Domain Sockets
  • Concurrent I/O with IO Multiplexing (select)
  • Shared Memory & File Mapping

Authors

  • Raz Cohen
  • Shir Bismuth

About

Multi-protocol C system for managing an atomic warehouse and molecule delivery, including TCP, UDP, Unix Domain Sockets clients, and a concurrent server with persistent inventory.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published