🌐 Advanced Real-Time Collaboration System
A distributed networking system showcasing custom protocol implementations
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.
Custom RDT 3.0+ implementation
Sliding windows with cumulative ACKs
Tahoe & Reno congestion control
Real-time RTT estimation
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
Docker-sandboxed environment
Network isolation (--network=none)
Resource limits (CPU, RAM, PIDs)
Ephemeral containers
🖥️ Application Interface
🏠 Home Dashboard
📁 File Transfer
💻 Code Editor
⚡ Code Execution
📊 Congestion Control Analytics
📈 RTT vs Chunk Sequence & CWND vs Event Sequence
📈 Window Size vs Transmission Round
📋 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
🔧 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
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
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
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
✅ Python 3.10+ (required for match-case syntax)
✅ Docker Desktop (must be running for code execution)
✅ pip (for dependency management)
# 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.
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
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
H.M. Mehedi Hasan
•
MD. Abu Bakar Siddique
Built with ❤️ using Python Sockets & Streamlit
⭐ Star this repository if you found it helpful!