# ductai05/socket architecture

> Architecture diagram of the GitHub repository ductai05/socket, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ductai05/socket
- Repository: https://github.com/ductai05/socket

## Overview

##### Main Components Identification

The system consists of three major components:
- Client Application (GUI-based using SDL2)
- Server Network (Multiple computers in LAN)
- Mail System (Communication bridge)

##### Client Side (Blue Rectangle)
- GUI Interface (SDL2-based)
- Mail Handler (SMTP/IMAP)
- Socket Client

##### Email Service Layer (Purple Cloud)
- Gmail SMTP Server
- Gmail IMAP Server

##### Server Network (Green Rectangle)
- Mail Listener
- Task Dispatcher
- Screenshot Service
- Socket Server
- Process Handler

##### Primary Communication Flow
- Client -> SMTP -> Gmail -> IMAP -> Server
- Server -> SMTP -> Gmail -> IMAP -> Client

##### Internal Server Network Flow
- Mail Listener -> Task Dispatcher -> Process Handler
- Process Handler -> Screenshot Service

##### Component Relationships

- Client GUI ↔ Mail Handler
- Mail Handler ↔ Gmail Services
- Gmail Services ↔ Server Mail Listener
- Server Mail Listener ↔ Task Dispatcher
- Task Dispatcher ↔ Process Handler
- Process Handler ↔ Screenshot Service

C. Technical Details to Include:

##### Protocols (Label on connections)
- SMTP/IMAP for email communication
- TCP/IP for socket connections
- LAN network protocols

##### Top Level
- Client on the left
- Gmail Services in the center
- Server Network on the right

##### Server Network Detail
- Internal components in a hierarchical structure
- LAN boundary
- File system interaction points

##### Security Flow
- Authentication points
- Encryption paths

##### Error Handling
- Error notification paths
- Retry mechanisms

##### File Operations
- Upload/download paths
- Screenshot storage

Remember to include version information and any relevant dependencies in a separate documentation section.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        GUI["Client GUI"]:::client
        MH["Mail Handler"]:::client
        SC["Socket Client"]:::client
        GUI --> MH
        MH --> SC
    end

    subgraph EmailService
        SMTP["Gmail SMTP Server"]:::email
        IMAP["Gmail IMAP Server"]:::email
    end

    subgraph ServerNetwork
        ML["Mail Listener"]:::server
        TD["Task Dispatcher"]:::server
        PH["Process Handler"]:::server
        SS["Screenshot Service"]:::server
        FS["File Storage"]:::server
        SOCK["Socket Server"]:::server

        ML --> TD
        TD --> PH
        PH --> SS
        SS --> FS
        PH --> SOCK
    end

    MH -->|SMTP| SMTP
    SMTP -->|Mail| IMAP
    IMAP -->|Mail| ML
    SC -->|TCP/IP| SOCK
    SOCK -->|TCP/IP| SC

    classDef client fill:#a8d1f0,stroke:#000
    classDef email fill:#e6b3ff,stroke:#000
    classDef server fill:#90EE90,stroke:#000

    click GUI "https://github.com/ductai05/socket/blob/main/client/client.cpp"
    click MH "https://github.com/ductai05/socket/blob/main/mail/mail.h"
    click ML "https://github.com/ductai05/socket/blob/main/mail/listen.cpp"
    click TD "https://github.com/ductai05/socket/blob/main/server/dispatcher.cpp"
    click PH "https://github.com/ductai05/socket/blob/main/server/process.h"
    click SS "https://github.com/ductai05/socket/blob/main/server/take_screenshot.cpp"
    click SOCK "https://github.com/ductai05/socket/blob/main/server/server.cpp"
    click FS "https://github.com/ductai05/socket/tree/main/server/uploads/"

    %% Legend
    subgraph Legend
        C1[Client Component]:::client
        E1[Email Service]:::email
        S1[Server Component]:::server
    end
```
