# rael0515/network_programming architecture

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

- Interactive diagram: https://gitdiagram.com/rael0515/network_programming
- Repository: https://github.com/rael0515/network_programming

## Overview

This is a collection of standalone C networking exercises, not a single integrated application. Its user-to-result workflow is generally to run a client with an address and port, enter data, and observe a server response. The directories cover socket and address fundamentals, TCP/UDP examples, file transfer, process- and thread-based servers, I/O multiplexing, and advanced socket behavior. The README identifies the repository as practice material; relationships below are limited to client interactions visible in sampled source, so most independent exercises have no asserted links.

Main entry points: [`ch2/tcp_client.c`](https://github.com/rael0515/network_programming/blob/main/ch2/tcp_client.c) (TCP Basics), [`ch4/echo_client.c`](https://github.com/rael0515/network_programming/blob/main/ch4/echo_client.c) (TCP Echo), [`ch5/echo_client2_2.c`](https://github.com/rael0515/network_programming/blob/main/ch5/echo_client2_2.c) (Echo Read Loop), [`ch6/uecho_client2.c`](https://github.com/rael0515/network_programming/blob/main/ch6/uecho_client2.c) (UDP Echo)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_basics["Socket Fundamentals"]
  node_tcp_basics["TCP Basics<br/>[tcp_client.c]"]
  node_addressing["Address Conversion<br/>[inet_ntoa.c]"]
end

subgraph group_protocols["Network Examples"]
  node_echo_tcp["TCP Echo<br/>[echo_client.c]"]
  node_echo_framing["Echo Read Loop<br/>[echo_client2_2.c]"]
  node_udp_echo["UDP Echo<br/>[uecho_client2.c]"]
  node_file_transfer["File Transfer<br/>[file_client.c]"]
  node_name_lookup["Host Lookup<br/>[gethostbyaddr.c]"]
  node_news_transfer["News Transfer<br/>[news_receiver.c]"]
  node_homework_udp["UDP Server Exercise<br/>[server.c]"]
end

subgraph group_concurrency["Concurrent Servers"]
  node_process_echo["Process-per-client Echo<br/>[echo_mpclient.c]"]
  node_stored_echo["Stored Echo Messages<br/>[echo_storeserv.c]"]
  node_chat_server["Threaded Chat Server<br/>[chat_serv.c]"]
end

subgraph group_io["I/O and Socket Features"]
  node_socket_options["Socket Options<br/>[echo_client.c]"]
  node_select_echo["Select-based Echo<br/>[echo_client.c]"]
  node_socket_messages["Urgent and Vector I/O<br/>[oob_recv.c]"]
  node_epoll_echo["Epoll Echo<br/>[echo_client.c]"]
end

node_user(("Terminal User"))
node_peer(("Remote Peer"))

node_user -->|"provides input"| node_tcp_basics
node_tcp_basics -->|"connects to"| node_peer
node_user -->|"provides input"| node_echo_tcp
node_echo_tcp -->|"sends and receives"| node_peer
node_user -->|"provides input"| node_echo_framing
node_echo_framing -->|"sends and receives"| node_peer
node_user -->|"provides datagrams"| node_udp_echo
node_udp_echo -->|"sends and receives"| node_peer
node_user -->|"provides input"| node_process_echo
node_process_echo -->|"connects to"| node_peer
node_user -->|"provides input"| node_select_echo
node_select_echo -->|"sends and receives"| node_peer
node_epoll_echo -->|"connects to"| node_peer

click node_tcp_basics "https://github.com/rael0515/network_programming/blob/main/ch2/tcp_client.c"
click node_addressing "https://github.com/rael0515/network_programming/blob/main/ch3/inet_ntoa.c"
click node_echo_tcp "https://github.com/rael0515/network_programming/blob/main/ch4/echo_client.c"
click node_echo_framing "https://github.com/rael0515/network_programming/blob/main/ch5/echo_client2_2.c"
click node_udp_echo "https://github.com/rael0515/network_programming/blob/main/ch6/uecho_client2.c"
click node_file_transfer "https://github.com/rael0515/network_programming/blob/main/ch7/file_client.c"
click node_name_lookup "https://github.com/rael0515/network_programming/blob/main/ch8/gethostbyaddr.c"
click node_socket_options "https://github.com/rael0515/network_programming/blob/main/ch9/echo_client.c"
click node_process_echo "https://github.com/rael0515/network_programming/blob/main/ch10_2/echo_mpclient.c"
click node_stored_echo "https://github.com/rael0515/network_programming/blob/main/ch11/echo_storeserv.c"
click node_select_echo "https://github.com/rael0515/network_programming/blob/main/ch12/echo_client.c"
click node_socket_messages "https://github.com/rael0515/network_programming/blob/main/ch13/oob_recv.c"
click node_news_transfer "https://github.com/rael0515/network_programming/blob/main/ch14/news_receiver.c"
click node_epoll_echo "https://github.com/rael0515/network_programming/blob/main/ch17/echo_client.c"
click node_chat_server "https://github.com/rael0515/network_programming/blob/main/ch18/chat_serv.c"
click node_homework_udp "https://github.com/rael0515/network_programming/blob/main/homework/04_02/server.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_tcp_basics,node_addressing,node_user toneBlue
class node_echo_tcp,node_echo_framing,node_udp_echo,node_file_transfer,node_name_lookup,node_news_transfer,node_homework_udp toneAmber
class node_process_echo,node_stored_echo,node_chat_server toneMint
class node_socket_options,node_select_echo,node_socket_messages,node_epoll_echo toneRose
class node_peer toneIndigo
```

## Components

### Socket Fundamentals

- [TCP Basics](https://github.com/rael0515/network_programming/blob/main/ch2/tcp_client.c): `ch2/tcp_client.c`
- [Address Conversion](https://github.com/rael0515/network_programming/blob/main/ch3/inet_ntoa.c): `ch3/inet_ntoa.c`

### Network Examples

- [TCP Echo](https://github.com/rael0515/network_programming/blob/main/ch4/echo_client.c): `ch4/echo_client.c`
- [Echo Read Loop](https://github.com/rael0515/network_programming/blob/main/ch5/echo_client2_2.c): `ch5/echo_client2_2.c`
- [UDP Echo](https://github.com/rael0515/network_programming/blob/main/ch6/uecho_client2.c): `ch6/uecho_client2.c`
- [File Transfer](https://github.com/rael0515/network_programming/blob/main/ch7/file_client.c): `ch7/file_client.c`
- [Host Lookup](https://github.com/rael0515/network_programming/blob/main/ch8/gethostbyaddr.c): `ch8/gethostbyaddr.c`
- [News Transfer](https://github.com/rael0515/network_programming/blob/main/ch14/news_receiver.c): `ch14/news_receiver.c`
- [UDP Server Exercise](https://github.com/rael0515/network_programming/blob/main/homework/04_02/server.c): `homework/04_02/server.c`

### Concurrent Servers

- [Process-per-client Echo](https://github.com/rael0515/network_programming/blob/main/ch10_2/echo_mpclient.c): `ch10_2/echo_mpclient.c`
- [Stored Echo Messages](https://github.com/rael0515/network_programming/blob/main/ch11/echo_storeserv.c): `ch11/echo_storeserv.c`
- [Threaded Chat Server](https://github.com/rael0515/network_programming/blob/main/ch18/chat_serv.c): `ch18/chat_serv.c`

### I/O and Socket Features

- [Socket Options](https://github.com/rael0515/network_programming/blob/main/ch9/echo_client.c): `ch9/echo_client.c`
- [Select-based Echo](https://github.com/rael0515/network_programming/blob/main/ch12/echo_client.c): `ch12/echo_client.c`
- [Urgent and Vector I/O](https://github.com/rael0515/network_programming/blob/main/ch13/oob_recv.c): `ch13/oob_recv.c`
- [Epoll Echo](https://github.com/rael0515/network_programming/blob/main/ch17/echo_client.c): `ch17/echo_client.c`

### Other components

- **Terminal User**
- **Remote Peer**

## Connections

- Terminal User → TCP Basics: provides input (evidence: `ch2/tcp_client.c`)
- TCP Basics → Remote Peer: connects to (evidence: `ch2/tcp_client.c`)
- Terminal User → TCP Echo: provides input
- TCP Echo → Remote Peer: sends and receives
- Terminal User → Echo Read Loop: provides input (evidence: `ch5/echo_client2_2.c`)
- Echo Read Loop → Remote Peer: sends and receives (evidence: `ch5/echo_client2_2.c`)
- Terminal User → UDP Echo: provides datagrams (evidence: `ch6/uecho_client2.c`)
- UDP Echo → Remote Peer: sends and receives (evidence: `ch6/uecho_client2.c`)
- Terminal User → Process-per-client Echo: provides input (evidence: `ch10_2/echo_mpclient.c`)
- Process-per-client Echo → Remote Peer: connects to (evidence: `ch10_2/echo_mpclient.c`)
- Terminal User → Select-based Echo: provides input (evidence: `ch12/echo_client.c`)
- Select-based Echo → Remote Peer: sends and receives (evidence: `ch12/echo_client.c`)
- Epoll Echo → Remote Peer: connects to (evidence: `ch17/echo_client.c`)
