# oldchong98/tcp-simulator architecture

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

- Interactive diagram: https://gitdiagram.com/oldchong98/tcp-simulator
- Repository: https://github.com/oldchong98/tcp-simulator

## Overview

This is an Electron TCP simulator: the user configures a connection, starts a TCP server or connects as a client, then exchanges and inspects messages. The renderer owns navigation, socket handling, message conversion and display; the Electron main process creates the window. The tree also identifies message setup and ISO configuration views, and the renderer excerpt shows ISO-config IPC requests. Those view-specific details and any persistence behavior are not fully sampled, so links beyond the shown calls are omitted.

Main entry points: [`renderer.js`](https://github.com/oldchong98/tcp-simulator/blob/main/renderer.js) (Renderer), [`index.html`](https://github.com/oldchong98/tcp-simulator/blob/main/index.html) (App shell), [`index.js`](https://github.com/oldchong98/tcp-simulator/blob/main/index.js) (Electron main), [`connection_setup.html`](https://github.com/oldchong98/tcp-simulator/blob/main/connection_setup.html) (Connection setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Electron app"]
  node_main["Electron main<br/>[index.js]"]
  node_shell["App shell<br/>[index.html]"]
  node_renderer["Renderer<br/>[renderer.js]"]
end

subgraph group_connection["TCP connections"]
  node_connection_view["Connection setup"]
  node_tcp_server["TCP server<br/>[renderer.js]"]
  node_tcp_client["TCP client<br/>[renderer.js]"]
end

subgraph group_messages["Message tools"]
  node_run_view["Run view<br/>[run.html]"]
  node_message_view["Message setup<br/>[message_setup.html]"]
  node_message_tools["Message tools<br/>[renderer.js]"]
  node_traffic_display["Traffic display<br/>[renderer.js]"]
end

subgraph group_config["Configuration"]
  node_iso_view["ISO config view<br/>[iso_config.html]"]
  node_iso_tools["ISO config tools<br/>[renderer.js]"]
end

node_user(("User"))
node_peer(("TCP peer"))

node_user -->|"opens app"| node_shell
node_main -->|"loads window"| node_shell
node_shell -.->|"runs interface"| node_renderer
node_user -->|"uses controls"| node_renderer
node_renderer -->|"loads view"| node_connection_view
node_renderer -->|"loads view"| node_run_view
node_renderer -.->|"loads view"| node_message_view
node_renderer -.->|"loads view"| node_iso_view
node_renderer -->|"starts server"| node_tcp_server
node_renderer -->|"connects client"| node_tcp_client
node_tcp_server -->|"accepts connection"| node_peer
node_tcp_client -->|"connects to"| node_peer
node_renderer -->|"handles input"| node_message_tools
node_message_tools -->|"writes bytes"| node_tcp_client
node_message_tools -->|"writes bytes"| node_tcp_server
node_tcp_client -->|"logs traffic"| node_traffic_display
node_tcp_server -->|"logs traffic"| node_traffic_display
node_renderer -->|"requests ISO configs"| node_main

click node_main "https://github.com/oldchong98/tcp-simulator/blob/main/index.js"
click node_shell "https://github.com/oldchong98/tcp-simulator/blob/main/index.html"
click node_renderer "https://github.com/oldchong98/tcp-simulator/blob/main/renderer.js"
click node_connection_view "https://github.com/oldchong98/tcp-simulator/blob/main/connection_setup.html"
click node_tcp_server "https://github.com/oldchong98/tcp-simulator/blob/main/renderer.js"
click node_tcp_client "https://github.com/oldchong98/tcp-simulator/blob/main/renderer.js"
click node_run_view "https://github.com/oldchong98/tcp-simulator/blob/main/run.html"
click node_message_view "https://github.com/oldchong98/tcp-simulator/blob/main/message_setup.html"
click node_message_tools "https://github.com/oldchong98/tcp-simulator/blob/main/renderer.js"
click node_traffic_display "https://github.com/oldchong98/tcp-simulator/blob/main/renderer.js"
click node_iso_view "https://github.com/oldchong98/tcp-simulator/blob/main/iso_config.html"
click node_iso_tools "https://github.com/oldchong98/tcp-simulator/blob/main/renderer.js"

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_main,node_shell,node_renderer,node_user toneBlue
class node_connection_view,node_tcp_server,node_tcp_client toneAmber
class node_run_view,node_message_view,node_message_tools,node_traffic_display toneMint
class node_iso_view,node_iso_tools toneRose
class node_peer toneIndigo
```

## Components

### Electron app

- [Electron main](https://github.com/oldchong98/tcp-simulator/blob/main/index.js): `index.js`
- [App shell](https://github.com/oldchong98/tcp-simulator/blob/main/index.html): `index.html`
- [Renderer](https://github.com/oldchong98/tcp-simulator/blob/main/renderer.js): `renderer.js`

### TCP connections

- [Connection setup](https://github.com/oldchong98/tcp-simulator/blob/main/connection_setup.html): `connection_setup.html`
- [TCP server](https://github.com/oldchong98/tcp-simulator/blob/main/renderer.js): `renderer.js`
- [TCP client](https://github.com/oldchong98/tcp-simulator/blob/main/renderer.js): `renderer.js`

### Message tools

- [Run view](https://github.com/oldchong98/tcp-simulator/blob/main/run.html): `run.html`
- [Message setup](https://github.com/oldchong98/tcp-simulator/blob/main/message_setup.html): `message_setup.html`
- [Message tools](https://github.com/oldchong98/tcp-simulator/blob/main/renderer.js): `renderer.js`
- [Traffic display](https://github.com/oldchong98/tcp-simulator/blob/main/renderer.js): `renderer.js`

### Configuration

- [ISO config view](https://github.com/oldchong98/tcp-simulator/blob/main/iso_config.html): `iso_config.html`
- [ISO config tools](https://github.com/oldchong98/tcp-simulator/blob/main/renderer.js): `renderer.js`

### Other components

- **User**
- **TCP peer**

## Connections

- User → App shell: opens app
- Electron main → App shell: loads window (evidence: `index.js`)
- App shell → Renderer: runs interface
- User → Renderer: uses controls (evidence: `renderer.js`)
- Renderer → Connection setup: loads view (evidence: `renderer.js`)
- Renderer → Run view: loads view (evidence: `renderer.js`)
- Renderer → Message setup: loads view
- Renderer → ISO config view: loads view
- Renderer → TCP server: starts server (evidence: `renderer.js`)
- Renderer → TCP client: connects client (evidence: `renderer.js`)
- TCP server → TCP peer: accepts connection (evidence: `renderer.js`)
- TCP client → TCP peer: connects to (evidence: `renderer.js`)
- Renderer → Message tools: handles input (evidence: `renderer.js`)
- Message tools → TCP client: writes bytes (evidence: `renderer.js`)
- Message tools → TCP server: writes bytes (evidence: `renderer.js`)
- TCP client → Traffic display: logs traffic (evidence: `renderer.js`)
- TCP server → Traffic display: logs traffic (evidence: `renderer.js`)
- Renderer → Electron main: requests ISO configs (evidence: `renderer.js`)
