summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuuta Liang <yuuta@yuuta.moe>2023-11-07 12:53:05 +0800
committerYuuta Liang <yuuta@yuuta.moe>2023-11-07 12:53:05 +0800
commitb18885e5d38b4744ce030cc4ea68df08345890e1 (patch)
tree68c4e7634481cc8131b2e6f944ed5a2f9b9b927e
parent6828a16ce960c2c8e3cc5d07523f4d5ad5d3f37b (diff)
downloadkb-b18885e5d38b4744ce030cc4ea68df08345890e1.tar
kb-b18885e5d38b4744ce030cc4ea68df08345890e1.tar.gz
kb-b18885e5d38b4744ce030cc4ea68df08345890e1.tar.bz2
kb-b18885e5d38b4744ce030cc4ea68df08345890e1.zip
Add TCP
-rw-r--r--docs/cs/networking/tcp.md47
-rw-r--r--mkdocs.yml1
2 files changed, 48 insertions, 0 deletions
diff --git a/docs/cs/networking/tcp.md b/docs/cs/networking/tcp.md
new file mode 100644
index 0000000..e7171e3
--- /dev/null
+++ b/docs/cs/networking/tcp.md
@@ -0,0 +1,47 @@
+# TCP
+
+TCP is a reliable and ordered byte stream built upon unreliable datagram-based
+Internet protocols.
+
+## Header format
+
+```
+ TCP Header Format
+ 0 1 2 3
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Source Port | Destination Port |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Sequence Number |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Acknowledgment Number |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Data | |U|A|P|R|S|F| |
+ | Offset| Reserved |R|C|S|S|Y|I| Window |
+ | | |G|K|H|T|N|N| |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Checksum | Urgent Pointer |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Options | Padding |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | data |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+ TCP Header Format
+
+ Note that one tick mark represents one bit position.
+
+ Figure 3.
+```
+
+Minimal length: 20 Bytes.
+
+## Handshake
+
+* Client -> Server: SYN
+* Server -> Client: SYNACK
+* Client -> Server: ACK (with payload)
+
+The SYN / ACK / SYNACK are specified in the flags part in the header.
+
+Sliding window / MSS / Fast open: TODO
diff --git a/mkdocs.yml b/mkdocs.yml
index 8457576..5687652 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -20,6 +20,7 @@ nav:
- cs/index.md
- Networking:
- cs/networking/index.md
+ - cs/networking/tcp.md
- System Administration:
- sysadmin/index.md
- Network Engineering: