# How Computer Networking Concepts Are Presented in the cs-self-learning Repository

> Explore how Computer Networking concepts are presented in the cs-self-learning repository. Learn via a two-layer path combining theory and hands-on systems programming from textbook fundamentals to building a TCP/IP stack.

- Repository: [Yinmin Zhong/cs-self-learning](https://github.com/PKUFlyingPig/cs-self-learning)
- Tags: tutorial
- Published: 2026-03-02

---

**The cs-self-learning repository structures Computer Networking concepts as a two-layer learning path that combines theoretical top-down education with hands-on systems programming, guiding learners from textbook fundamentals in `docs/计算机网络/topdown.md` to building a complete TCP/IP stack in `docs/计算机网络/CS144.md`.**

The PKUFlyingPig/cs-self-learning repository offers a curated progression through Computer Networking concepts, balancing conceptual understanding with practical implementation. This educational resource structures networking education as a progressive curriculum that moves from high-level protocol overviews to low-level C++ systems programming. Learners explore both the theoretical layers of the Internet protocol stack and the concrete code required to implement them.

## Two-Layer Architecture for Learning Computer Networking

The repository implements a distinctive two-layer approach that separates conceptual mastery from implementation skills. This architecture ensures learners understand *why* protocols work before discovering *how* to build them.

### Top-Down Theoretical Foundation

The first layer resides in **`docs/计算机网络/topdown.md`**, which provides a concise overview of the classic Kurose & Ross "top-down" approach used at UMass. This file maps the standard protocol hierarchy from application layer down through transport, network, link, and physical layers. It aggregates interactive resources including official course websites, lecture videos, online quizzes, and Wireshark packet-capture labs. Learners begin with high-level concepts such as HTTP and DNS before descending into transport layer mechanics, ensuring they grasp the end-to-end principles that govern modern networking.

### Systems Programming Deep Dive

The second layer lives in **`docs/计算机网络/CS144.md`**, documenting the Stanford CS144 curriculum that transforms theory into working code. This section enumerates eight progressive checkpoints that culminate in a complete end-to-end TCP/IP stack running in a simulated network environment. Starting with simple network utilities like `telnet` and `netcat`, learners progressively implement the three-way handshake, ARP resolution, routing algorithms, and multithreaded networking primitives. The curriculum emphasizes building protocols from scratch in C++, encouraging exploration of underlying packet structures and socket implementations such as the `TCPMinnowSocket` class used in later assignments.

## Navigation and Resource Discovery

The **`docs/使用指南.md`** file contains a navigation table that links the "Computer Networking" entry directly to the top-down overview, making the networking track instantly discoverable from the repository's main index. Both networking pages aggregate external resource collections including course repositories, archived lecture videos, and community blogs. The repository also references personal GitHub forks (e.g., `PKUFlyingPig/Computer-Network-A-Top-Down-Approach`) that provide ready-to-clone code samples and lab solutions, ensuring learners have immediate access to implementation references alongside theoretical explanations.

## Practical Code Examples

The repository encourages hands-on experimentation with networking primitives before attempting full stack implementation. Below are representative code patterns that mirror the progression from simple socket manipulation to systems-level programming.

### Basic TCP Client in Python

This Python example demonstrates the socket creation and HTTP request logic that corresponds to "checkpoint 0" warm-up exercises:

```python
import socket

def fetch(host: str, port: int = 80, path: str = "/"):
    with socket.create_connection((host, port)) as sock:
        request = f"GET {path} HTTP/1.1\r\nHost: {host}\r\n\r\n"
        sock.sendall(request.encode())
        response = b""
        while chunk := sock.recv(4096):
            response += chunk
    print(response.decode(errors="ignore"))

if __name__ == "__main__":
    fetch("example.com")

```

This snippet illustrates basic socket creation, request serialization, and stream buffering—exactly the networking fundamentals learners master before advancing to transport layer implementation.

### Minimal C++ TCP Client

This C++ example reflects the style of programming required for the CS144 checkpoints, demonstrating direct system call usage for network communication:

```cpp
#include <arpa/inet.h>
#include <unistd.h>
#include <cstring>
#include <iostream>

int main() {
    int sock = socket(AF_INET, SOCK_STREAM, 0);
    sockaddr_in server{};
    server.sin_family = AF_INET;
    server.sin_port = htons(12345);
    inet_pton(AF_INET, "127.0.0.1", &server.sin_addr);

    if (connect(sock, (sockaddr*)&server, sizeof(server)) < 0) {
        perror("connect");
        return 1;
    }

    const char *msg = "hello from client";
    send(sock, msg, std::strlen(msg), 0);

    char buf[1024] = {};
    ssize_t len = recv(sock, buf, sizeof(buf) - 1, 0);
    if (len > 0) {
        buf[len] = '\0';
        std::cout << "Server replied: " << buf << std::endl;
    }
    close(sock);
    return 0;
}

```

This code demonstrates the raw socket API that underlies the higher-level abstractions implemented in the CS144 TCP/IP stack project.

## Summary

- The cs-self-learning repository presents Computer Networking concepts through a **two-layer curriculum** that interleaves theory with implementation.
- **Top-down theory** in `docs/计算机网络/topdown.md` provides the Kurose & Ross conceptual framework with interactive Wireshark labs.
- **Systems programming** in `docs/计算机网络/CS144.md` offers eight checkpoints for building a complete TCP/IP stack from scratch in C++.
- **Centralized navigation** via `docs/使用指南.md` ensures learners can locate resources efficiently.
- **Prerequisite progression** moves learners from Python socket scripting to C++ transport layer implementation, covering the three-way handshake, ARP, and routing protocols.

## Frequently Asked Questions

### What prerequisites are required before starting the Computer Networking track?

According to the source material in `docs/计算机网络/topdown.md`, learners should possess foundational system knowledge including basic programming proficiency and familiarity with operating system concepts. The CS144 track specifically requires comfort with C++ and Unix development environments, as the eight checkpoints involve implementing kernel-adjacent networking code including the `TCPMinnowSocket` abstraction.

### How does the Stanford CS144 curriculum differ from standard networking courses?

Unlike courses that focus exclusively on protocol analysis or configuration, the CS144 implementation documented in `docs/计算机网络/CS144.md` requires learners to build a full TCP/IP stack from the ground up. This includes implementing the three-way handshake, ARP resolution, routing tables, and multithreaded packet processing, providing concrete understanding of how theoretical concepts from the top-down layer translate into operating system networking code.

### Where can I find the hands-on lab materials mentioned in the repository?

The `docs/计算机网络/topdown.md` file aggregates links to official course websites, archived lecture videos, and Wireshark labs associated with the Kurose & Ross textbook. For the implementation track, `docs/计算机网络/CS144.md` provides direct links to the Stanford course materials and references personal GitHub forks containing starter code and testing frameworks for the eight checkpoints.

### Is the networking content available in languages other than Chinese?

While the primary documentation resides in Chinese markdown files, the repository structure suggests potential availability of `docs/计算机网络/topdown.en.md` for English-speaking learners. Additionally, the external resources linked from both networking pages—including UMass and Stanford course materials—are predominantly available in English, making the technical content accessible regardless of the navigation language.