# miguelrg14/vs_csharp-networking architecture

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

- Interactive diagram: https://gitdiagram.com/miguelrg14/vs_csharp-networking
- Repository: https://github.com/miguelrg14/vs_csharp-networking

## Overview

This repository combines a TCP group-chat application with standalone networking coursework. The chat workflow is console client → framed TCP lines → asynchronous server registration and command handling → thread-safe room broadcasts and message history, with interchangeable memory or SQLite storage. The server also serves history, search, and author statistics; the coursework separately demonstrates threads and a raw-socket echo server. Edges reflect calls visible in excerpts or capabilities documented in the README; unsampled command details are represented only where documented.

Main entry points: [`src/Chat.Core/ChatServer.cs`](https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Core/ChatServer.cs) (Async server), [`src/Chat.Core/ChatRoom.cs`](https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Core/ChatRoom.cs) (Chat room), [`src/Chat.Core/IMessageStore.cs`](https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Core/IMessageStore.cs) (Store interface), [`src/Chat.Server/Program.cs`](https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Server/Program.cs) (Server console)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_apps["Chat applications"]
  node_client_app["Client console<br/>[Program.cs]"]
  node_server_app["Server console<br/>[Program.cs]"]
end

subgraph group_runtime["Chat runtime"]
  node_chat_client["TCP client<br/>[ChatClient.cs]"]
  node_line_connection["Line connection<br/>[LineConnection.cs]"]
  node_protocol["Chat protocol<br/>[ChatProtocol.cs]"]
  node_chat_server["Async server<br/>[ChatServer.cs]"]
  node_chat_room["Chat room<br/>[ChatRoom.cs]"]
  node_message["Chat messages<br/>[ChatMessage.cs]"]
end

subgraph group_storage["Message storage"]
  node_store_contract["Store interface<br/>[IMessageStore.cs]"]
  node_memory_store[("Memory history")]
  node_sqlite_store[("SQLite history")]
  node_sqlite_db[("SQLite database")]
end

subgraph group_coursework["Networking coursework"]
  node_basics_app["Basics console<br/>[Program.cs]"]
  node_thread_exercises["Thread exercises<br/>[ThreadExercises.cs]"]
  node_echo_demo["Echo demo<br/>[EchoDemo.cs]"]
  node_echo_server["Raw-socket echo<br/>[EchoServer.cs]"]
end

node_chat_user(("Chat user"))

node_chat_user -->|"types input"| node_client_app
node_client_app -->|"connects and sends"| node_chat_client
node_chat_client -->|"reads and writes"| node_line_connection
node_client_app -->|"uses commands"| node_protocol
node_server_app -->|"starts and runs"| node_chat_server
node_server_app -->|"selects memory"| node_memory_store
node_server_app -->|"opens SQLite"| node_sqlite_store
node_chat_server -->|"serves lines"| node_line_connection
node_chat_server -->|"registers and dispatches"| node_chat_room
node_chat_server -->|"handles commands"| node_protocol
node_chat_room -->|"creates messages"| node_message
node_chat_room -->|"adds history"| node_store_contract
node_chat_room -->|"queries history"| node_store_contract
node_store_contract -->|"implemented by"| node_memory_store
node_store_contract -->|"implemented by"| node_sqlite_store
node_sqlite_store -->|"reads and writes"| node_sqlite_db
node_basics_app -->|"runs exercises"| node_thread_exercises
node_basics_app -->|"runs demo"| node_echo_demo
node_echo_demo -->|"starts server"| node_echo_server

click node_client_app "https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Client/Program.cs"
click node_chat_client "https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Core/ChatClient.cs"
click node_line_connection "https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Core/LineConnection.cs"
click node_protocol "https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Core/ChatProtocol.cs"
click node_server_app "https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Server/Program.cs"
click node_chat_server "https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Core/ChatServer.cs"
click node_chat_room "https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Core/ChatRoom.cs"
click node_message "https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Core/ChatMessage.cs"
click node_store_contract "https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Core/IMessageStore.cs"
click node_memory_store "https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Core/InMemoryMessageStore.cs"
click node_sqlite_store "https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Storage.Sqlite/SqliteMessageStore.cs"
click node_basics_app "https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/NetworkingBasics/Program.cs"
click node_thread_exercises "https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/NetworkingBasics/Exercises/ThreadExercises.cs"
click node_echo_demo "https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/NetworkingBasics/Echo/EchoDemo.cs"
click node_echo_server "https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/NetworkingBasics/Echo/EchoServer.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_client_app,node_server_app,node_chat_user toneBlue
class node_chat_client,node_line_connection,node_protocol,node_chat_server,node_chat_room,node_message toneAmber
class node_store_contract,node_memory_store,node_sqlite_store,node_sqlite_db toneMint
class node_basics_app,node_thread_exercises,node_echo_demo,node_echo_server toneRose
```

## Components

### Chat applications

- [Client console](https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Client/Program.cs): `src/Chat.Client/Program.cs`
- [Server console](https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Server/Program.cs): `src/Chat.Server/Program.cs`

### Chat runtime

- [TCP client](https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Core/ChatClient.cs): `src/Chat.Core/ChatClient.cs`
- [Line connection](https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Core/LineConnection.cs): `src/Chat.Core/LineConnection.cs`
- [Chat protocol](https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Core/ChatProtocol.cs): `src/Chat.Core/ChatProtocol.cs`
- [Async server](https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Core/ChatServer.cs): `src/Chat.Core/ChatServer.cs`
- [Chat room](https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Core/ChatRoom.cs): `src/Chat.Core/ChatRoom.cs`
- [Chat messages](https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Core/ChatMessage.cs): `src/Chat.Core/ChatMessage.cs`

### Message storage

- [Store interface](https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Core/IMessageStore.cs): `src/Chat.Core/IMessageStore.cs`
- [Memory history](https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Core/InMemoryMessageStore.cs): `src/Chat.Core/InMemoryMessageStore.cs`
- [SQLite history](https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/Chat.Storage.Sqlite/SqliteMessageStore.cs): `src/Chat.Storage.Sqlite/SqliteMessageStore.cs`
- **SQLite database**

### Networking coursework

- [Basics console](https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/NetworkingBasics/Program.cs): `src/NetworkingBasics/Program.cs`
- [Thread exercises](https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/NetworkingBasics/Exercises/ThreadExercises.cs): `src/NetworkingBasics/Exercises/ThreadExercises.cs`
- [Echo demo](https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/NetworkingBasics/Echo/EchoDemo.cs): `src/NetworkingBasics/Echo/EchoDemo.cs`
- [Raw-socket echo](https://github.com/miguelrg14/vs_csharp-networking/blob/main/src/NetworkingBasics/Echo/EchoServer.cs): `src/NetworkingBasics/Echo/EchoServer.cs`

### Other components

- **Chat user**

## Connections

- Chat user → Client console: types input (evidence: `src/Chat.Client/Program.cs`)
- Client console → TCP client: connects and sends (evidence: `src/Chat.Client/Program.cs`)
- TCP client → Line connection: reads and writes (evidence: `src/Chat.Core/ChatClient.cs`)
- Client console → Chat protocol: uses commands (evidence: `src/Chat.Client/Program.cs`)
- Server console → Async server: starts and runs (evidence: `src/Chat.Server/Program.cs`)
- Server console → Memory history: selects memory (evidence: `src/Chat.Server/Program.cs`)
- Server console → SQLite history: opens SQLite (evidence: `src/Chat.Server/Program.cs`)
- Async server → Line connection: serves lines (evidence: `src/Chat.Core/ChatServer.cs`)
- Async server → Chat room: registers and dispatches (evidence: `src/Chat.Core/ChatServer.cs`)
- Async server → Chat protocol: handles commands (evidence: `src/Chat.Core/ChatServer.cs`)
- Chat room → Chat messages: creates messages (evidence: `src/Chat.Core/ChatRoom.cs`)
- Chat room → Store interface: adds history (evidence: `src/Chat.Core/ChatRoom.cs`)
- Chat room → Store interface: queries history (evidence: `src/Chat.Core/ChatRoom.cs`)
- Store interface → Memory history: implemented by (evidence: `src/Chat.Core/InMemoryMessageStore.cs`)
- Store interface → SQLite history: implemented by (evidence: `src/Chat.Storage.Sqlite/SqliteMessageStore.cs`)
- SQLite history → SQLite database: reads and writes (evidence: `src/Chat.Storage.Sqlite/SqliteMessageStore.cs`)
- Basics console → Thread exercises: runs exercises (evidence: `src/NetworkingBasics/Program.cs`)
- Basics console → Echo demo: runs demo (evidence: `src/NetworkingBasics/Program.cs`)
- Echo demo → Raw-socket echo: starts server (evidence: `src/NetworkingBasics/Echo/EchoDemo.cs`)
