# simchateich/simple-chat architecture

> Architecture diagram of the GitHub repository simchateich/simple-chat, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/simchateich/simple-chat
- Repository: https://github.com/simchateich/simple-chat

## Overview

Simple-Chat is a GUI instant-messaging client and threaded server, with file downloads over TCP or reliable Go-Back-N UDP. The main workflow is GUI action → client request logic → server protocol handling → response or chat update; downloads negotiate a transfer port before moving file data. The README documents these capabilities, while the excerpts show key calls and protocol handling. Some GUI and server paths are only partially excerpted, so unsampled internal links are omitted.

Main entry points: [`Server/Server.py`](https://github.com/simchateich/simple-chat/blob/main/Server/Server.py) (Protocol Handler), [`Client/GUI.py`](https://github.com/simchateich/simple-chat/blob/main/Client/GUI.py) (Chat GUI), [`Client/logic.py`](https://github.com/simchateich/simple-chat/blob/main/Client/logic.py) (Request Logic), [`Client/analysis_unit.py`](https://github.com/simchateich/simple-chat/blob/main/Client/analysis_unit.py) (Response Parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client"]
  node_gui["Chat GUI<br/>[GUI.py]"]
  node_client_logic["Request Logic<br/>[logic.py]"]
  node_client_analysis["Response Parser<br/>[analysis_unit.py]"]
  node_client_listener["Update Listener<br/>[GUI.py]"]
end

subgraph group_server["Server"]
  node_server_main["Server Entry<br/>[main.py]"]
  node_server_listener["Connection Listener<br/>[Server.py]"]
  node_client_service["Client Service<br/>[Server.py]"]
  node_protocol_handler["Protocol Handler<br/>[Server.py]"]
  node_protocol_codes["Protocol Codes<br/>[Protocol.py]"]
  node_client_record["Client Session<br/>[Client.py]"]
  node_chat_routes["Chat Messaging<br/>[Server.py]"]
  node_presence["Presence Updates<br/>[Server.py]"]
  node_file_catalog["File Catalog<br/>[Server.py]"]
end

subgraph group_transfer["File Transfer"]
  node_download_control["Download Negotiation<br/>[Server.py]"]
  node_tcp_transfer["TCP Transfer<br/>[Server.py]"]
  node_udp_sender["Go-Back-N Sender<br/>[RDT_Sender.py]"]
  node_udp_receiver["Go-Back-N Receiver<br/>[RDT_Receiver.py]"]
end

node_user(("Chat User"))

node_user -->|"uses"| node_gui
node_gui -->|"dispatches requests"| node_client_logic
node_gui -->|"parses updates"| node_client_analysis
node_gui -->|"starts listener"| node_client_listener
node_client_listener -->|"parses messages"| node_client_analysis
node_client_logic -->|"parses responses"| node_client_analysis
node_client_logic -->|"sends requests"| node_protocol_handler
node_server_main -->|"starts listening"| node_server_listener
node_server_listener -->|"starts client thread"| node_client_service
node_client_service -->|"routes messages"| node_protocol_handler
node_protocol_handler -->|"uses codes"| node_protocol_codes
node_protocol_handler -->|"creates session"| node_client_record
node_protocol_handler -->|"handles chat requests"| node_chat_routes
node_protocol_handler -->|"broadcasts changes"| node_presence
node_protocol_handler -->|"lists files"| node_file_catalog
node_protocol_handler -->|"negotiates download"| node_download_control
node_download_control -->|"starts UDP sender"| node_udp_sender
node_download_control -->|"starts TCP sender"| node_tcp_transfer
node_gui -->|"starts UDP receive"| node_udp_receiver
node_udp_sender -->|"transfers datagrams"| node_udp_receiver

click node_gui "https://github.com/simchateich/simple-chat/blob/main/Client/GUI.py"
click node_client_logic "https://github.com/simchateich/simple-chat/blob/main/Client/logic.py"
click node_client_analysis "https://github.com/simchateich/simple-chat/blob/main/Client/analysis_unit.py"
click node_client_listener "https://github.com/simchateich/simple-chat/blob/main/Client/GUI.py"
click node_server_main "https://github.com/simchateich/simple-chat/blob/main/Server/main.py"
click node_server_listener "https://github.com/simchateich/simple-chat/blob/main/Server/Server.py"
click node_client_service "https://github.com/simchateich/simple-chat/blob/main/Server/Server.py"
click node_protocol_handler "https://github.com/simchateich/simple-chat/blob/main/Server/Server.py"
click node_protocol_codes "https://github.com/simchateich/simple-chat/blob/main/Server/Protocol.py"
click node_client_record "https://github.com/simchateich/simple-chat/blob/main/Server/Client.py"
click node_chat_routes "https://github.com/simchateich/simple-chat/blob/main/Server/Server.py"
click node_presence "https://github.com/simchateich/simple-chat/blob/main/Server/Server.py"
click node_file_catalog "https://github.com/simchateich/simple-chat/blob/main/Server/Server.py"
click node_download_control "https://github.com/simchateich/simple-chat/blob/main/Server/Server.py"
click node_tcp_transfer "https://github.com/simchateich/simple-chat/blob/main/Server/Server.py"
click node_udp_sender "https://github.com/simchateich/simple-chat/blob/main/Server/RDT_Sender.py"
click node_udp_receiver "https://github.com/simchateich/simple-chat/blob/main/Client/RDT_Receiver.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_gui,node_client_logic,node_client_analysis,node_client_listener,node_user toneBlue
class node_server_main,node_server_listener,node_client_service,node_protocol_handler,node_protocol_codes,node_client_record,node_chat_routes,node_presence,node_file_catalog toneAmber
class node_download_control,node_tcp_transfer,node_udp_sender,node_udp_receiver toneMint
```

## Components

### Client

- [Chat GUI](https://github.com/simchateich/simple-chat/blob/main/Client/GUI.py): `Client/GUI.py`
- [Request Logic](https://github.com/simchateich/simple-chat/blob/main/Client/logic.py): `Client/logic.py`
- [Response Parser](https://github.com/simchateich/simple-chat/blob/main/Client/analysis_unit.py): `Client/analysis_unit.py`
- [Update Listener](https://github.com/simchateich/simple-chat/blob/main/Client/GUI.py): `Client/GUI.py`

### Server

- [Server Entry](https://github.com/simchateich/simple-chat/blob/main/Server/main.py): `Server/main.py`
- [Connection Listener](https://github.com/simchateich/simple-chat/blob/main/Server/Server.py): `Server/Server.py`
- [Client Service](https://github.com/simchateich/simple-chat/blob/main/Server/Server.py): `Server/Server.py`
- [Protocol Handler](https://github.com/simchateich/simple-chat/blob/main/Server/Server.py): `Server/Server.py`
- [Protocol Codes](https://github.com/simchateich/simple-chat/blob/main/Server/Protocol.py): `Server/Protocol.py`
- [Client Session](https://github.com/simchateich/simple-chat/blob/main/Server/Client.py): `Server/Client.py`
- [Chat Messaging](https://github.com/simchateich/simple-chat/blob/main/Server/Server.py): `Server/Server.py`
- [Presence Updates](https://github.com/simchateich/simple-chat/blob/main/Server/Server.py): `Server/Server.py`
- [File Catalog](https://github.com/simchateich/simple-chat/blob/main/Server/Server.py): `Server/Server.py`

### File Transfer

- [Download Negotiation](https://github.com/simchateich/simple-chat/blob/main/Server/Server.py): `Server/Server.py`
- [TCP Transfer](https://github.com/simchateich/simple-chat/blob/main/Server/Server.py): `Server/Server.py`
- [Go-Back-N Sender](https://github.com/simchateich/simple-chat/blob/main/Server/RDT_Sender.py): `Server/RDT_Sender.py`
- [Go-Back-N Receiver](https://github.com/simchateich/simple-chat/blob/main/Client/RDT_Receiver.py): `Client/RDT_Receiver.py`

### Other components

- **Chat User**

## Connections

- Chat User → Chat GUI: uses (evidence: `README.md`)
- Chat GUI → Request Logic: dispatches requests (evidence: `Client/GUI.py`)
- Chat GUI → Response Parser: parses updates (evidence: `Client/GUI.py`)
- Chat GUI → Update Listener: starts listener (evidence: `Client/GUI.py`)
- Update Listener → Response Parser: parses messages (evidence: `Client/GUI.py`)
- Request Logic → Response Parser: parses responses (evidence: `Client/logic.py`)
- Request Logic → Protocol Handler: sends requests (evidence: `README.md`)
- Server Entry → Connection Listener: starts listening (evidence: `Server/main.py`)
- Connection Listener → Client Service: starts client thread (evidence: `Server/Server.py`)
- Client Service → Protocol Handler: routes messages (evidence: `Server/Server.py`)
- Protocol Handler → Protocol Codes: uses codes (evidence: `Server/Server.py`)
- Protocol Handler → Client Session: creates session (evidence: `Server/Server.py`)
- Protocol Handler → Chat Messaging: handles chat requests (evidence: `Server/Server.py`)
- Protocol Handler → Presence Updates: broadcasts changes (evidence: `Server/Server.py`)
- Protocol Handler → File Catalog: lists files (evidence: `README.md`)
- Protocol Handler → Download Negotiation: negotiates download (evidence: `Server/Server.py`)
- Download Negotiation → Go-Back-N Sender: starts UDP sender (evidence: `Server/Server.py`)
- Download Negotiation → TCP Transfer: starts TCP sender (evidence: `Server/Server.py`)
- Chat GUI → Go-Back-N Receiver: starts UDP receive (evidence: `Client/GUI.py`)
- Go-Back-N Sender → Go-Back-N Receiver: transfers datagrams (evidence: `README.md`)
