Abstract

In an era of cloud dependency, data privacy within local organizations is often overlooked. This project implements an ultra-lightweight, high-performance chat solution designed strictly for on-premise use. Engineered with Python and Socket programming, it supports over 6,000 concurrent connections, ensuring secure communication entirely within the local network (LAN) with zero internet dependency.

The Project

The goal was to build a robust Client-Server architecture (Star Topology) that prioritizes speed and privacy.

The server acts as a multithreaded TCP engine, managing a dynamic client registry and routing JSON packets. Clients utilize independent threads for simultaneous sending and receiving, creating a fluid, real-time user experience without UI blocking.

Client Server Architecture Visualization

Project Development

Development Environment and Code

The development focused on scalability and stability under load. Key technical achievements include:

  • Multithreading: Handling 6000+ simultaneous clients.
  • TCP Coalescing Fix: Implemented timing strategies to prevent packet merging during high-traffic handshakes.
  • Dockerization: Complete container support for "write once, run anywhere" deployment.
  • CI/CD: Automated testing via GitHub Actions.

Deployment & Usage

The system is designed for flexibility. You can deploy the server using Docker for an instant setup:
docker-compose up -d Or run it manually with Python. Once the server is live on the LAN, clients can connect by specifying the IP address, creating an instant, secure, private chatroom for the office or home network.

Get the Docker Image
Docker Deployment

Communication Protocol

To ensure reliability across different OS and network conditions, a strict JSON protocol is enforced for all data packets.

Packet Structure

Every message sent over the TCP socket adheres to this schema:

{
  "from": { 
      "name": "User_Alias", 
      "ip": "192.168.1.X" 
  },
  "to": "Broadcast_or_Target_IP",
  "msg": "Content of the message..."
}
This standardization allows for easy expansion of the protocol to include file transfers or encryption in the future.