Skip to content

Python Chat Application which establishes TCP connection between the server and multiple client processes.

Notifications You must be signed in to change notification settings

Dipto9999/TCP_Chat_Application

Repository files navigation

Chat Application with TCP Connection

Contents

Overview

We developed a chat application in Python to implement a Client-Server Model via Transmission Control Protocol (TCP). We built this to meet the following base requirement :

The chat service provider (i.e. server) must be able to manage multiple clients in the system without a significant drop in performance.

Program Design

The server and clients are managed via multiprocessing as these represent seperate entities (i.e. each have their own code section and Global Interpreter Lock (GIL)).

Handshakes are performed and messages are handled (i.e. received/sent from client to server) via multithreading for concurrency.

Disconnections

There has been error handling implemented for both the chat server and clients to appropriately handle disconnections, including a client leaving the system, as well as server shutdown.

We have implemented this, such that the same client can attempt reconnection and communicate via a reestablished server application.

Synchronization

The server threads which handle client messages implement Inter-Process Communication (IPC) via memory sharing. They have read-write access to the socketInfo data field, which is a list of dicts (i.e. with the socket object and address tuple).

If a client socket is closed and a server thread is unable to successfully send a message, it removes the socket information from the socketInfo data field in a critical section.

This is to ensure other threads are made aware of this client leaving the system, as well as to avoid subsequent communication attempts by the current thread.

UML Sequence Diagram

We have illustrated the following UML Sequence Diagram to describe the high-level interactions in our program.

Note that all connections and disconnections are implemented via TCP.

Demonstration

We have uploaded our Final Demo on Youtube.

Demo.mp4

Credit

This was completed as part of the CPEN 333 - Software Design course in The University of British Columbia Electrical and Computer Engineering undergraduate program. We received tremendous support and guidance from Dr. Farshid Agharebparast.

About

Python Chat Application which establishes TCP connection between the server and multiple client processes.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages