# mobtone/chattkonsolapp architecture

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

- Interactive diagram: https://gitdiagram.com/mobtone/chattkonsolapp
- Repository: https://github.com/mobtone/chattkonsolapp

## Overview

This is a small console-based TCP chat application. A user enters a server address and port in the client, supplies a display name, and sends messages; the server accepts connections, reads messages in per-client handlers, and relays them to other connected clients. The client also reads incoming messages on a separate thread. The server maintains an in-memory client list and displays a local address for invitations. The graph reflects the sampled runtime code and README; it does not imply message persistence, authentication, or encryption.

Main entry points: [`ChattKonsolApp/ChatServer.cs`](https://github.com/mobtone/chattkonsolapp/blob/master/ChattKonsolApp/ChatServer.cs) (Server listener), [`ChatClient/ChatClient.cs`](https://github.com/mobtone/chattkonsolapp/blob/master/ChatClient/ChatClient.cs) (Chat client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Chat client"]
  node_chat_client["Chat client<br/>[ChatClient.cs]"]
end

subgraph group_server["Chat server"]
  node_server_main["Server listener<br/>[ChatServer.cs]"]
  node_client_handler["Client handler<br/>[ChatServer.cs]"]
  node_client_list[("Client list<br/>[ChatServer.cs]")]
  node_broadcast["Message relay<br/>[ChatServer.cs]"]
  node_ip_discovery["IP discovery<br/>[ChatServer.cs]"]
end

node_user(("Console user"))
node_connected_clients(("Other chat clients"))

node_user -->|"enters address and messages"| node_chat_client
node_chat_client -->|"connects TCP"| node_server_main
node_server_main -->|"starts handler"| node_client_handler
node_server_main -->|"adds client"| node_client_list
node_server_main -->|"gets local address"| node_ip_discovery
node_client_handler -->|"relays message"| node_broadcast
node_client_handler -->|"removes client"| node_client_list
node_broadcast -->|"iterates clients"| node_client_list
node_broadcast -->|"sends message"| node_connected_clients
node_chat_client -->|"displays messages"| node_user

click node_chat_client "https://github.com/mobtone/chattkonsolapp/blob/master/ChatClient/ChatClient.cs"
click node_server_main "https://github.com/mobtone/chattkonsolapp/blob/master/ChattKonsolApp/ChatServer.cs"
click node_client_handler "https://github.com/mobtone/chattkonsolapp/blob/master/ChattKonsolApp/ChatServer.cs"
click node_client_list "https://github.com/mobtone/chattkonsolapp/blob/master/ChattKonsolApp/ChatServer.cs"
click node_broadcast "https://github.com/mobtone/chattkonsolapp/blob/master/ChattKonsolApp/ChatServer.cs"
click node_ip_discovery "https://github.com/mobtone/chattkonsolapp/blob/master/ChattKonsolApp/ChatServer.cs"

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_chat_client,node_user,node_connected_clients toneBlue
class node_server_main,node_client_handler,node_client_list,node_broadcast,node_ip_discovery toneAmber
```

## Components

### Chat client

- [Chat client](https://github.com/mobtone/chattkonsolapp/blob/master/ChatClient/ChatClient.cs): `ChatClient/ChatClient.cs`

### Chat server

- [Server listener](https://github.com/mobtone/chattkonsolapp/blob/master/ChattKonsolApp/ChatServer.cs): `ChattKonsolApp/ChatServer.cs`
- [Client handler](https://github.com/mobtone/chattkonsolapp/blob/master/ChattKonsolApp/ChatServer.cs): `ChattKonsolApp/ChatServer.cs`
- [Client list](https://github.com/mobtone/chattkonsolapp/blob/master/ChattKonsolApp/ChatServer.cs): `ChattKonsolApp/ChatServer.cs`
- [Message relay](https://github.com/mobtone/chattkonsolapp/blob/master/ChattKonsolApp/ChatServer.cs): `ChattKonsolApp/ChatServer.cs`
- [IP discovery](https://github.com/mobtone/chattkonsolapp/blob/master/ChattKonsolApp/ChatServer.cs): `ChattKonsolApp/ChatServer.cs`

### Other components

- **Console user**
- **Other chat clients**

## Connections

- Console user → Chat client: enters address and messages (evidence: `ChatClient/ChatClient.cs`)
- Chat client → Server listener: connects TCP (evidence: `ChatClient/ChatClient.cs`)
- Server listener → Client handler: starts handler (evidence: `ChattKonsolApp/ChatServer.cs`)
- Server listener → Client list: adds client (evidence: `ChattKonsolApp/ChatServer.cs`)
- Server listener → IP discovery: gets local address (evidence: `ChattKonsolApp/ChatServer.cs`)
- Client handler → Message relay: relays message (evidence: `ChattKonsolApp/ChatServer.cs`)
- Client handler → Client list: removes client (evidence: `ChattKonsolApp/ChatServer.cs`)
- Message relay → Client list: iterates clients (evidence: `ChattKonsolApp/ChatServer.cs`)
- Message relay → Other chat clients: sends message (evidence: `ChattKonsolApp/ChatServer.cs`)
- Chat client → Console user: displays messages (evidence: `ChatClient/ChatClient.cs`)
