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.
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
- GCC compiler
- POSIX-compliant OS (Linux recommended)
- Make utility
sudo apt install build-essentialmakedrinks_bar– server application (with console interface)atom_supplier– TCP client to add atomsmolecule_requester– UDP client to request molecule deliveries
Server
./server/drinks_bar -t 60 -T 5555 -o 12 -U 7777 -f inventory.datAtom Supplier (TCP client)
./clients/atom_supplier -h 127.0.0.1 -p 5555
ADD CARBON 10
ADD OXYGEN 5
ADD HYDROGEN 20Molecule Requester (UDP client)
./clients/molecule_requester -h 127.0.0.1 -p 7777
DELIVER WATER 3
DELIVER GLUCOSE 2From 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
- 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
- Raz Cohen
- Shir Bismuth