Skip to content

Abs-Futy7/SyncroX

Repository files navigation

SyncroX Logo

Typing SVG

🌐 Advanced Real-Time Collaboration System
A distributed networking system showcasing custom protocol implementations

Quick Start Screenshots GitHub

Python Streamlit Docker Reliable UDP TCP


🎯 What is SyncroX?

SyncroX is a real-time collaborative and communication platform demonstrating advanced networking concepts including custom TCP protocols, Tahoe/Reno congestion control, RTT estimation, and secure Docker-based code execution β€” all built entirely from scratch using Python sockets. It features reliable file sharing, instant messaging with image CDN, and synchronous collaborative editing.

SyncroX Landing Page


⚑ Key Features

πŸ“‘ Reliable UDP Protocol

  • Custom RDT 3.0+ implementation
  • Sliding windows with cumulative ACKs
  • Tahoe & Reno congestion control
  • Real-time RTT estimation

πŸ’¬ Real-time Chat System

  • Custom TCP application layer protocol
  • Image CDN with lazy loading
  • Instant message broadcast
  • Persistent chat history

πŸ“ Collaborative Code Editor

  • Live document synchronization
  • Multi-user editing support
  • 500ms update frequency
  • Last-Write-Wins conflict resolution

🐳 Secure Code Execution

  • Docker-sandboxed environment
  • Network isolation (--network=none)
  • Resource limits (CPU, RAM, PIDs)
  • Ephemeral containers

πŸ“Έ Screenshots

πŸ–₯️ Application Interface
Dashboard
🏠 Home Dashboard
File Transfer
πŸ“ File Transfer
Code Editor
πŸ’» Code Editor
Execution
⚑ Code Execution
πŸ“Š Congestion Control Analytics
RTT and CWND
πŸ“ˆ RTT vs Chunk Sequence & CWND vs Event Sequence
Window Size
πŸ“ˆ Window Size vs Transmission Round

πŸ—οΈ Architecture

System Architecture

πŸ“‹ Service Details
Service Port Protocol Description
πŸ–₯️ Frontend 8501 HTTP Streamlit UI Gateway
πŸ”‘ Room Manager 9013 TCP Room lifecycle management
πŸ’¬ Chat Service 9009 TCP Messaging & image CDN
πŸ“‚ File Control 9010 TCP File listing & signaling
πŸ“‘ File Data 9011 UDP Reliable data transfer
πŸ“ Collab Service 9011 TCP Document synchronization
🐳 Exec Service 9012 TCP Docker code execution

πŸ“‘ Technical Deep Dives

πŸ”§ Reliable UDP Protocol

Packet Structure (JSON over UDP)

{
  "type": "DATA",           // SYN | SYN-ACK | ACK | DATA | FIN | FIN-ACK
  "seq": 105,               // Sequence Number
  "ack": 105,               // Acknowledgement Number
  "rwnd": 64,               // Receiver Window Size
  "room": "ABCD",           // Room context
  "filename": "doc.pdf",    // File context
  "payload_b64": "...",     // Base64 encoded chunk (4KB)
  "session_id": "a1b2c3d4"  // Session token
}

RTT Estimation (Jacobson/Karels)

Parameter Formula Value
Smoothed RTT (1-Ξ±)Β·SRTT + Ξ±Β·RTTsample Ξ± = 0.125
RTT Variance `(1-Ξ²)Β·RTTVAR + Ξ²Β· SRTT - RTTsample
RTO SRTT + 4Β·RTTVAR Min: 200ms

Congestion Control

Event Tahoe 🐒 Reno 🦊
Timeout CWND = 1, Slow Start Same
3 Dup ACKs CWND = 1, Slow Start CWND = ssthresh + 3, Fast Recovery
πŸ’¬ TCP Chat Protocol

Command Reference

Command Direction Description
HELLO <user> <room> C β†’ S Join room
MSG <content> C β†’ S Send message
IMG <filename> <b64> C β†’ S Upload image
GET_IMG <filename> C β†’ S Fetch image
BYE C β†’ S Disconnect

CDN Lazy Loading

Step Action Description
1 πŸ“€ Broadcast Server sends metadata only
2 πŸ–ΌοΈ Render Client shows placeholder
3 πŸ“₯ Fetch On-demand binary request
4 πŸ’Ύ Cache Store in backend/data/cdn/
πŸ›‘οΈ Docker Security Profile
Flag Value Purpose
--network none Total network isolation
--memory 256m Prevent RAM exhaustion
--cpus 0.5 Fair CPU scheduling
--pids-limit 64 Prevent fork bombs
--rm true Auto-cleanup containers

πŸš€ Quick Start

Prerequisites

βœ… Python 3.10+     (required for match-case syntax)
βœ… Docker Desktop   (must be running for code execution)
βœ… pip              (for dependency management)

Installation

# Clone the repository
git clone https://github.com/Abs-Futy7/SyncroX.git
cd SyncroX

# Create virtual environment
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Build Docker image
docker build -t syncro-sandbox ./backend/code_exec/

# Start servers
python start_all_servers_venv.py

# Launch frontend (new terminal)
streamlit run frontend/streamlit_app/app.py

⚠️ Note: Ensure Docker Desktop is running before starting the servers.

Verify Installation

Step Action Expected
1 Click "Create New Room" 4-digit code appears
2 Open new tab, enter code Join as second user
3 Send chat message Instant delivery
4 Upload file See congestion graph
5 Run code Docker execution works

πŸ“ Project Structure

SyncroX/
β”œβ”€β”€ πŸ“‚ backend/
β”‚   β”œβ”€β”€ πŸ“‚ code_exec/          # 🐳 Docker execution engine
β”‚   β”œβ”€β”€ πŸ“‚ collab/             # πŸ“ Collaborative editor
β”‚   β”œβ”€β”€ πŸ“‚ file_transfer/      # πŸ“‘ UDP file transfer
β”‚   β”œβ”€β”€ πŸ“‚ room_mgmt/          # πŸ”‘ Room management
β”‚   └── πŸ“‚ tcp_chat/           # πŸ’¬ Chat protocol
β”œβ”€β”€ πŸ“‚ frontend/               # πŸ–₯️ Streamlit UI
β”œβ”€β”€ πŸ“‚ App_Screenshots/        # πŸ“Έ Screenshots
β”œβ”€β”€ πŸ“‚ assets/                 # 🎨 Branding
β”œβ”€β”€ πŸ“„ config.py               # βš™οΈ Configuration
β”œβ”€β”€ πŸ“„ requirements.txt        # πŸ“¦ Dependencies
└── πŸ“„ start_all_servers_venv.py  # πŸš€ Launcher

πŸ‘¨β€πŸ’» Authors

Β Β Β Β Β Β Β Β 

H.M. Mehedi Hasan Β Β β€’Β Β  MD. Abu Bakar Siddique

GitHub Β  GitHub



Built with ❀️ using Python Sockets & Streamlit

Python Sockets Streamlit

⭐ Star this repository if you found it helpful!

About

A collaborative platform demonstrating advanced networking concepts including custom TCP protocols, Tahoe/Reno congestion control, RTT estimation, and secure Docker-based code execution for the Computer Networking Lab course.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors