Skip to content

Latest commit

 

History

History
372 lines (293 loc) · 11.3 KB

File metadata and controls

372 lines (293 loc) · 11.3 KB

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!