A full 7-layer OSI model simulator that runs on real network sockets. Launching
simulation.py spawns five separate processes — a server, a router, an L2 switch,
and two clients — each with its own tkinter window. A message typed by a client is
encapsulated down all seven layers, travels over actual localhost TCP connections through the
switch and router (which rewrites MAC headers), and is decapsulated back up at the server,
with every layer's header visible and color-coded in the live logs.
- Real sockets — frames move over localhost TCP ports (9000/9100/8080), not simulated hops
- Five concurrent GUIs —
multiprocessingspawns Server, Router, Switch, Client A, Client B - Per-layer headers you can read — every encapsulation step adds a real header (JSON app payload → encoding → session → TCP-style segmentation with seq/flags/window → IP → MAC frame → raw bits at L1)
- Working network devices — the switch counts received/forwarded/dropped frames; the router rewrites MAC addresses between "networks"
- Standard library only —
tkinter,socket,threading,multiprocessing,json
cd CN_Group_3_AIE_D
python simulation.pyFive windows open. In a client window, type a message and send — then watch it travel: each node's log shows the layer-by-layer encapsulation (client side) and decapsulation (server side), with progress bars and sent/received panels.
| Layer | Module | What it does |
|---|---|---|
| 7 Application | layers/layer_7_application.py |
Wraps the mail message in a JSON app header |
| 6 Presentation | layers/layer_6_presentation.py |
Encodes/decodes the payload |
| 5 Session | layers/layer_5_session.py |
Session tagging |
| 4 Transport | layers/layer_4_transport.py |
Segments at 100 bytes with seq/total/flags/window |
| 3 Network | layers/layer_3_network.py |
IP header per hop |
| 2 Data link | layers/layer_2_data_link.py |
MAC frame; switch forwarding, router rewriting |
| 1 Physical | layers/layer_1_physical.py |
Bit-level transmission |
| Path | Purpose |
|---|---|
simulation.py |
Main launcher — spawns all five node processes |
config.py |
Topology constants (IPs, MACs, ports, segment size) |
utils.py |
Color coding + logging helpers |
layers/ |
One module per OSI layer with encapsulate() / decapsulate() |
Group project for Computer Networks (Group 3, AIE-D).