Skip to content

Client Group3

GiZano edited this page Jan 23, 2026 · 1 revision

Group 3 Client Implementation

Overview

The Group 3 Client is a lightweight, thread-safe Command Line Interface (CLI) application. It prioritizes low latency and code clarity, serving as a reference implementation for the shared protocol.

Key Features

1. Smart Path Resolution

Since the client resides in client/Group3/ but depends on utils.py in the root, we utilize a dynamic system path fix:

import sys, os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')))
import utils

This allows the client to run without manually moving files or setting environment variables.

2. Threaded Architecture

To prevent the UI from freezing while waiting for messages, the client uses Python's threading module:

  • Main Thread: Handles user input and sending messages.
  • Daemon Thread: Background listener for incoming TCP packets.

3. Auto-Discovery

The client utilizes utils.get_local_ip() to determine the machine's actual network address, rather than hardcoding 127.0.0.1.

Operational Guide

Prerequisites

  • Ensure the Server is running before starting the client.

How to Run

cd client/Group3
python client.py

Usage

  1. Login: Enter your desired username.
  2. Addressing: Input the target username when prompted with To:.
  3. Sending: Type your message.
  4. Receiving: Incoming messages appear asynchronously as >>> Sender: Message.

Known Issues / Roadmap

  • Issue: The input prompt (To:) may be overwritten visually when an incoming message arrives.
    • Fix Planned: Implement curses or purely asynchronous input handling.
  • Feature: Add color-coding for different senders.

🔙 Back to Home | ⚙️ Server Specs