# qiubrian/reliable-udp-sender architecture

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

- Interactive diagram: https://gitdiagram.com/qiubrian/reliable-udp-sender
- Repository: https://github.com/qiubrian/reliable-udp-sender

## Overview

This is a Windows command-line UDP file-data transfer sender, not a general networking framework. The user supplies a host and link/window/loss parameters; `main` validates them, creates a DWORD payload, opens a sender session, sends chunks, closes the session, and compares a local CRC32 with the receiver-reported checksum. `SenderSocket` owns connection setup, packet transmission, ACK/retransmission handling, worker coordination, optional congestion control, and FIN-based shutdown. The excerpts establish the main calls and several worker/ACK relationships; unsampled method bodies limit finer-grained claims.

Main entry points: [`CSCE_463_HW_3_P3/main.cpp`](https://github.com/qiubrian/reliable-udp-sender/blob/main/CSCE_463_HW_3_P3/main.cpp) (CLI and validation), [`CSCE_463_HW_3_P3/SenderSocket.cpp`](https://github.com/qiubrian/reliable-udp-sender/blob/main/CSCE_463_HW_3_P3/SenderSocket.cpp) (Send workers), [`CSCE_463_HW_3_P3/CheckSum.cpp`](https://github.com/qiubrian/reliable-udp-sender/blob/main/CSCE_463_HW_3_P3/CheckSum.cpp) (CRC32 calculator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Command line"]
  node_cli["CLI and validation<br/>[main.cpp]"]
  node_payload["DWORD payload<br/>[main.cpp]"]
end

subgraph group_protocol["Sender protocol"]
  node_session["Session setup<br/>[SenderSocket.cpp]"]
  node_sender["SenderSocket<br/>[SenderSocket.cpp]"]
  node_workers["Send workers<br/>[SenderSocket.cpp]"]
  node_ack["ACK and recovery<br/>[SenderSocket.cpp]"]
  node_congestion["Congestion control<br/>[SenderSocket.cpp]"]
  node_shutdown["FIN shutdown<br/>[SenderSocket.cpp]"]
end

subgraph group_integrity["Integrity check"]
  node_checksum["CRC32 calculator<br/>[CheckSum.cpp]"]
end

node_user(("Operator"))
node_receiver["UDP receiver"]
node_winsock["Windows sockets"]

node_user -->|"provides arguments"| node_cli
node_cli -->|"initializes"| node_payload
node_cli -->|"opens session"| node_session
node_cli -->|"sends chunks"| node_sender
node_cli -->|"closes session"| node_shutdown
node_cli -->|"computes CRC32"| node_checksum
node_cli -->|"reads receiver checksum"| node_sender
node_sender -->|"dispatches workers"| node_workers
node_workers -->|"sends packets"| node_sender
node_workers -->|"receives ACKs"| node_ack
node_ack -->|"updates send state"| node_sender
node_ack -->|"updates window"| node_congestion
node_ack -->|"requests retransmit"| node_workers
node_session -->|"resolves UDP host"| node_winsock
node_workers -->|"sends and receives"| node_winsock
node_winsock -->|"exchanges UDP packets"| node_receiver
node_shutdown -->|"sends FIN"| node_receiver

click node_cli "https://github.com/qiubrian/reliable-udp-sender/blob/main/CSCE_463_HW_3_P3/main.cpp"
click node_payload "https://github.com/qiubrian/reliable-udp-sender/blob/main/CSCE_463_HW_3_P3/main.cpp"
click node_session "https://github.com/qiubrian/reliable-udp-sender/blob/main/CSCE_463_HW_3_P3/SenderSocket.cpp"
click node_sender "https://github.com/qiubrian/reliable-udp-sender/blob/main/CSCE_463_HW_3_P3/SenderSocket.cpp"
click node_workers "https://github.com/qiubrian/reliable-udp-sender/blob/main/CSCE_463_HW_3_P3/SenderSocket.cpp"
click node_ack "https://github.com/qiubrian/reliable-udp-sender/blob/main/CSCE_463_HW_3_P3/SenderSocket.cpp"
click node_congestion "https://github.com/qiubrian/reliable-udp-sender/blob/main/CSCE_463_HW_3_P3/SenderSocket.cpp"
click node_shutdown "https://github.com/qiubrian/reliable-udp-sender/blob/main/CSCE_463_HW_3_P3/SenderSocket.cpp"
click node_checksum "https://github.com/qiubrian/reliable-udp-sender/blob/main/CSCE_463_HW_3_P3/CheckSum.cpp"

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_cli,node_payload toneBlue
class node_session,node_sender,node_workers,node_ack,node_congestion,node_shutdown toneAmber
class node_checksum toneMint
class node_user,node_receiver,node_winsock toneIndigo
```

## Components

### Command line

- [CLI and validation](https://github.com/qiubrian/reliable-udp-sender/blob/main/CSCE_463_HW_3_P3/main.cpp): `CSCE_463_HW_3_P3/main.cpp`
- [DWORD payload](https://github.com/qiubrian/reliable-udp-sender/blob/main/CSCE_463_HW_3_P3/main.cpp): `CSCE_463_HW_3_P3/main.cpp`

### Sender protocol

- [Session setup](https://github.com/qiubrian/reliable-udp-sender/blob/main/CSCE_463_HW_3_P3/SenderSocket.cpp): `CSCE_463_HW_3_P3/SenderSocket.cpp`
- [SenderSocket](https://github.com/qiubrian/reliable-udp-sender/blob/main/CSCE_463_HW_3_P3/SenderSocket.cpp): `CSCE_463_HW_3_P3/SenderSocket.cpp`
- [Send workers](https://github.com/qiubrian/reliable-udp-sender/blob/main/CSCE_463_HW_3_P3/SenderSocket.cpp): `CSCE_463_HW_3_P3/SenderSocket.cpp`
- [ACK and recovery](https://github.com/qiubrian/reliable-udp-sender/blob/main/CSCE_463_HW_3_P3/SenderSocket.cpp): `CSCE_463_HW_3_P3/SenderSocket.cpp`
- [Congestion control](https://github.com/qiubrian/reliable-udp-sender/blob/main/CSCE_463_HW_3_P3/SenderSocket.cpp): `CSCE_463_HW_3_P3/SenderSocket.cpp`
- [FIN shutdown](https://github.com/qiubrian/reliable-udp-sender/blob/main/CSCE_463_HW_3_P3/SenderSocket.cpp): `CSCE_463_HW_3_P3/SenderSocket.cpp`

### Integrity check

- [CRC32 calculator](https://github.com/qiubrian/reliable-udp-sender/blob/main/CSCE_463_HW_3_P3/CheckSum.cpp): `CSCE_463_HW_3_P3/CheckSum.cpp`

### Other components

- **Operator**
- **UDP receiver**
- **Windows sockets**

## Connections

- Operator → CLI and validation: provides arguments (evidence: `CSCE_463_HW_3_P3/main.cpp`)
- CLI and validation → DWORD payload: initializes (evidence: `CSCE_463_HW_3_P3/main.cpp`)
- CLI and validation → Session setup: opens session (evidence: `CSCE_463_HW_3_P3/main.cpp`)
- CLI and validation → SenderSocket: sends chunks (evidence: `CSCE_463_HW_3_P3/main.cpp`)
- CLI and validation → FIN shutdown: closes session (evidence: `CSCE_463_HW_3_P3/main.cpp`)
- CLI and validation → CRC32 calculator: computes CRC32 (evidence: `CSCE_463_HW_3_P3/main.cpp`)
- CLI and validation → SenderSocket: reads receiver checksum (evidence: `CSCE_463_HW_3_P3/main.cpp`)
- SenderSocket → Send workers: dispatches workers (evidence: `CSCE_463_HW_3_P3/SenderSocket.cpp`)
- Send workers → SenderSocket: sends packets (evidence: `CSCE_463_HW_3_P3/SenderSocket.cpp`)
- Send workers → ACK and recovery: receives ACKs (evidence: `CSCE_463_HW_3_P3/SenderSocket.cpp`)
- ACK and recovery → SenderSocket: updates send state (evidence: `CSCE_463_HW_3_P3/SenderSocket.cpp`)
- ACK and recovery → Congestion control: updates window (evidence: `CSCE_463_HW_3_P3/SenderSocket.cpp`)
- ACK and recovery → Send workers: requests retransmit (evidence: `CSCE_463_HW_3_P3/SenderSocket.cpp`)
- Session setup → Windows sockets: resolves UDP host (evidence: `CSCE_463_HW_3_P3/SenderSocket.cpp`)
- Send workers → Windows sockets: sends and receives (evidence: `CSCE_463_HW_3_P3/SenderSocket.cpp`)
- Windows sockets → UDP receiver: exchanges UDP packets
- FIN shutdown → UDP receiver: sends FIN (evidence: `CSCE_463_HW_3_P3/SenderSocket.cpp`)
