Skip to content

About

7-layer OSI model simulator — five networked tkinter processes (clients, switch, router, server) exchanging real socket traffic with per-layer encapsulation

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

OSI Model Simulation in Python

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.

Why it's more than a diagram

  • Real sockets — frames move over localhost TCP ports (9000/9100/8080), not simulated hops
  • Five concurrent GUIs — multiprocessing spawns 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

Run it

cd CN_Group_3_AIE_D
python simulation.py

Five 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 map

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

Layout

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).

About

7-layer OSI model simulator — five networked tkinter processes (clients, switch, router, server) exchanging real socket traffic with per-layer encapsulation

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages