# guillermo495/proyecto-chat architecture

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

- Interactive diagram: https://gitdiagram.com/guillermo495/proyecto-chat
- Repository: https://github.com/guillermo495/proyecto-chat

## Overview

This repository implements a TCP chat with a C server and C# console client. A user connects, identifies by username, then sends public or private text, requests the user list, or changes presence; the server processes messages and emits responses and chat events. The graph separates client interaction, server networking, message handling, and JSON support. Server-side handler details are only partly sampled, so documented capabilities are included without guessing their internal dispatch paths.

Main entry points: [`cliente-csharp/Program.cs`](https://github.com/guillermo495/proyecto-chat/blob/main/cliente-csharp/Program.cs) (Client entry), [`servidor-c/src/servidor.c`](https://github.com/guillermo495/proyecto-chat/blob/main/servidor-c/src/servidor.c) (TCP server), [`cliente-csharp/ControladorCliente.cs`](https://github.com/guillermo495/proyecto-chat/blob/main/cliente-csharp/ControladorCliente.cs) (Console controller), [`cliente-csharp/ConexionCliente.cs`](https://github.com/guillermo495/proyecto-chat/blob/main/cliente-csharp/ConexionCliente.cs) (TCP connection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["C&#35; client"]
  node_program["Client entry<br/>[Program.cs]"]
  node_client_controller["Console controller"]
  node_client_protocol["Client protocol"]
  node_client_connection["TCP connection<br/>[ConexionCliente.cs]"]
end

subgraph group_network["Server networking"]
  node_server_main["Server entry<br/>[main.c]"]
  node_server["TCP server<br/>[servidor.c]"]
end

subgraph group_chat["Chat handling"]
  node_client_state["Client session<br/>[cliente.c]"]
  node_controller["Message controller<br/>[controlador.c]"]
  node_server_protocol["Server protocol<br/>[protocolo.c]"]
end

subgraph group_json["JSON support"]
  node_cjson["cJSON library<br/>[cJSON.c]"]
end

node_user(("Chat user"))

node_user -->|"uses"| node_program
node_program -->|"connects"| node_client_connection
node_program -->|"identifies with"| node_client_protocol
node_program -->|"starts"| node_client_controller
node_client_controller -->|"sends and receives"| node_client_connection
node_client_controller -->|"builds and describes"| node_client_protocol
node_client_connection -->|"exchanges TCP messages"| node_server
node_server_main -->|"starts"| node_server
node_server -->|"delivers complete messages"| node_controller
node_server -.->|"manages connections"| node_client_state
node_controller -.->|"parses and builds messages"| node_server_protocol
node_server_protocol -->|"uses JSON parser"| node_cjson

click node_program "https://github.com/guillermo495/proyecto-chat/blob/main/cliente-csharp/Program.cs"
click node_client_controller "https://github.com/guillermo495/proyecto-chat/blob/main/cliente-csharp/ControladorCliente.cs"
click node_client_protocol "https://github.com/guillermo495/proyecto-chat/blob/main/cliente-csharp/ProtocoloCliente.cs"
click node_client_connection "https://github.com/guillermo495/proyecto-chat/blob/main/cliente-csharp/ConexionCliente.cs"
click node_server_main "https://github.com/guillermo495/proyecto-chat/blob/main/servidor-c/src/main.c"
click node_server "https://github.com/guillermo495/proyecto-chat/blob/main/servidor-c/src/servidor.c"
click node_client_state "https://github.com/guillermo495/proyecto-chat/blob/main/servidor-c/src/cliente.c"
click node_controller "https://github.com/guillermo495/proyecto-chat/blob/main/servidor-c/src/controlador.c"
click node_server_protocol "https://github.com/guillermo495/proyecto-chat/blob/main/servidor-c/src/protocolo.c"
click node_cjson "https://github.com/guillermo495/proyecto-chat/blob/main/servidor-c/externos/cjson/cJSON.c"

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_program,node_client_controller,node_client_protocol,node_client_connection,node_user toneBlue
class node_server_main,node_server toneAmber
class node_client_state,node_controller,node_server_protocol toneMint
class node_cjson toneRose
```

## Components

### C# client

- [Client entry](https://github.com/guillermo495/proyecto-chat/blob/main/cliente-csharp/Program.cs): `cliente-csharp/Program.cs`
- [Console controller](https://github.com/guillermo495/proyecto-chat/blob/main/cliente-csharp/ControladorCliente.cs): `cliente-csharp/ControladorCliente.cs`
- [Client protocol](https://github.com/guillermo495/proyecto-chat/blob/main/cliente-csharp/ProtocoloCliente.cs): `cliente-csharp/ProtocoloCliente.cs`
- [TCP connection](https://github.com/guillermo495/proyecto-chat/blob/main/cliente-csharp/ConexionCliente.cs): `cliente-csharp/ConexionCliente.cs`

### Server networking

- [Server entry](https://github.com/guillermo495/proyecto-chat/blob/main/servidor-c/src/main.c): `servidor-c/src/main.c`
- [TCP server](https://github.com/guillermo495/proyecto-chat/blob/main/servidor-c/src/servidor.c): `servidor-c/src/servidor.c`

### Chat handling

- [Client session](https://github.com/guillermo495/proyecto-chat/blob/main/servidor-c/src/cliente.c): `servidor-c/src/cliente.c`
- [Message controller](https://github.com/guillermo495/proyecto-chat/blob/main/servidor-c/src/controlador.c): `servidor-c/src/controlador.c`
- [Server protocol](https://github.com/guillermo495/proyecto-chat/blob/main/servidor-c/src/protocolo.c): `servidor-c/src/protocolo.c`

### JSON support

- [cJSON library](https://github.com/guillermo495/proyecto-chat/blob/main/servidor-c/externos/cjson/cJSON.c): `servidor-c/externos/cjson/cJSON.c`

### Other components

- **Chat user**

## Connections

- Chat user → Client entry: uses (evidence: `cliente-csharp/Program.cs`)
- Client entry → TCP connection: connects (evidence: `cliente-csharp/Program.cs`)
- Client entry → Client protocol: identifies with (evidence: `cliente-csharp/Program.cs`)
- Client entry → Console controller: starts (evidence: `cliente-csharp/Program.cs`)
- Console controller → TCP connection: sends and receives (evidence: `cliente-csharp/ControladorCliente.cs`)
- Console controller → Client protocol: builds and describes (evidence: `cliente-csharp/ControladorCliente.cs`)
- TCP connection → TCP server: exchanges TCP messages
- Server entry → TCP server: starts (evidence: `servidor-c/src/main.c`)
- TCP server → Message controller: delivers complete messages
- TCP server → Client session: manages connections
- Message controller → Server protocol: parses and builds messages
- Server protocol → cJSON library: uses JSON parser (evidence: `servidor-c/src/protocolo.c`)
