https://github.com/archisman-mridha/tcp-server
Building a TCP server from scratch in each of : Rust, Zig and C
https://github.com/archisman-mridha/tcp-server
c rust tcp tcp-server zig
Last synced: 2 months ago
JSON representation
Building a TCP server from scratch in each of : Rust, Zig and C
- Host: GitHub
- URL: https://github.com/archisman-mridha/tcp-server
- Owner: Archisman-Mridha
- Created: 2024-11-23T14:31:28.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-08T18:05:20.000Z (about 1 year ago)
- Last Synced: 2025-04-08T19:24:42.982Z (about 1 year ago)
- Topics: c, rust, tcp, tcp-server, zig
- Language: Zig
- Homepage:
- Size: 31.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Implementing a TCP server from scratch
## Knowledge nuggets
- The UT8 or ASCII encoding of 4,294,967,295 takes 10 bytes - 1 byte per digit. The binary encoding takes 4 bytes; quite the space saving! Conversely, the UTF8 or ASCII encoding of "63" uses just 2 bytes, versus the 4 byte if we're using a **4-byte fixed length**.
> There are variable-length binary encoding scheme, such as the `varint` used by Google's **Protocol Buffer**.
- Some protocols use **both delimiters and some type of prefix**. HTTP, for example, uses delimiters for its headers, but the body's length is typically defined by the text-encoded Content-Length header. Redis also stands out as having a mix of both delimiters (for ease of human-readability) and text-encoded length prefix.
- Elixir and Erlang have strong support for **vectored I/O**.
## REFERENCEs
- [TUN/TAP](https://en.wikipedia.org/wiki/TUN/TAP)
- [TRANSMISSION CONTROL PROTOCOL](https://datatracker.ietf.org/doc/html/rfc9293)
- [INTERNET PROTOCOL](https://datatracker.ietf.org/doc/html/rfc791)
- [Datagrams](https://en.wikipedia.org/wiki/Datagram)
- [SYN flood attack](https://www.cloudflare.com/en-in/learning/ddos/syn-flood-ddos-attack/)
- [What is the difference between a slice and an array in Rust?](https://stackoverflow.com/a/30794371/20891099)
- [TCP Server in Zig - Part 1 - Single Threaded](https://www.openmymind.net/TCP-Server-In-Zig-Part-1-Single-Threaded/)