NetworkComm

TCP client server chat application demonstrating networking, protocol design, and concurrency.

Python TCP sockets threading Concurrency Protocol design Systems fundamentals

Overview

NetworkComm is a Python-based TCP client server chat application built to demonstrate core networking, concurrency, and protocol-design concepts. It supports multiple clients connecting to a central server and exchanging messages in real time using socket programming and multithreading.

The project prioritises correctness, clarity, and real-world networking behaviour over UI complexity.

Server work

The server was originally developed collaboratively as part of a coursework project. I independently enhanced it with structured message logging, improved error handling for client disconnects, clearer message formatting, and more robust coordination between clients.

Message routing Error handling Structured logging Maintainability

Client work

I implemented the client independently, including user interaction, server communication, retry logic when the server is unavailable, and asynchronous message reception using concurrent threads.

Async receive Retry logic CLI interface

Key features

Real-time messaging features built on top of an explicit text-based protocol.

TCP socket communication Multithreaded server Broadcast messaging Private messaging Chat rooms User visibility controls Timestamped formatting Graceful disconnect handling Connection retry logic

All communication is routed through the server to simplify coordination and maintain consistent state. Clients send and receive concurrently so user input does not block incoming messages.

Architecture

How the system coordinates multiple clients in real time.

The server listens on a specified host and port, while clients connect and register with a nickname. For each connected client, the server spawns a dedicated handler thread. Messages are routed through the server based on message type, including broadcast, private messages, or room-based messaging.

On the client side, sending and receiving are handled concurrently using separate threads to support an interactive experience without blocking on socket reads.

One handler thread per client Server routing Client send/receive concurrency

Tech stack

Tools and environment used to build the system.

Python socket threading utf-8 Localhost / LAN

Getting started

Running the server and connecting multiple clients.

Start the server using the command below, then run multiple client instances to simulate concurrent users.

Run server

python server.py

Run client

python mbylut003_client.py

When prompted, enter the server IP address and port. The default is 127.0.0.1 and 44444. Then provide a nickname and begin chatting.

Learning outcomes

What this project demonstrates.

This project strengthened my understanding of TCP/IP communication, concurrency using threads, and client server coordination. It also improved how I think about protocol design, synchronization, and real-world failure conditions such as disconnects, message framing, and ordering.

TCP/IP reasoning Concurrency Protocol design Debugging network systems Failure modes Component ownership

Limitations and scope

What is intentionally out of scope.

This project prioritizes conceptual correctness over production-grade security. Authentication, encryption, and fault tolerance are intentionally out of scope. Messages are transmitted in plain text and users are identified only by nickname.

No encryption No authentication In-memory state only Single-server design

Future enhancements

Planned improvements include explicit protocol framing for reliability, authentication and authorization, TLS support, persistence for chat history and room metadata, improved scalability through asynchronous I/O, configurable logging, and testing for protocol and concurrency behaviours.

Explicit message framing Auth TLS Persistence Async I/O Testing
Back to Projects