This repository contains my solutions for the assignments from Stanford CS144: Computer Networking (Winter 2025) which I self-studied during Summer 2025. The course gradually builds a simplified TCP/IP stack from scratch, providing a deep understanding of how networking works under the hood.
Implemented a finite, flow-controlled byte stream abstraction:
- Supports writing from an input end and reading from an output end.
- Flow-controlled: enforces a strict
capacitylimit (number of bytes held in memory). - Handles end-of-input (EOF) signaling.
- Can carry streams of arbitrary length even with tiny memory capacity.
Constructed a Reassembler:
- Accepts out-of-order substrings with indices.
- Reassembles them into the original byte stream in order.
- Writes to the same
ByteStreambuilt in Assignment 0.
Built the TCPReceiver:
- Translates received segments into reassembled streams.
- Tracks:
- acknowledgment number (ackno): first missing byte index.
- window size: how much more data the receiver can accept.
- Integrates the TCP view of sequencing with our previous byte stream and reassembler.
Implemented the TCPSender:
- Reads from the
ByteStreamand generates outgoing segments. - Manages:
- Receiver window (acknowledgment and size).
- Sending new data (including SYN/FIN).
- Retransmitting unacknowledged ("outstanding") segments.
Built the NetworkInterface to support Ethernet + ARP:
- Maintains a cache from IP → MAC (ARP cache).
- Sends ARP requests when the MAC of the next hop is unknown.
- Queues outgoing datagrams until ARP resolution completes.
- Responds to ARP requests and updates cache with ARP replies.
- Cleans up expired ARP entries.
Implemented a multi-interface IP router:
- Maintains a routing table: each rule defines a
prefix,prefix_length, optionalnext_hop, andinterface_num. - Forwards datagrams based on longest-prefix matching.
- Drops packets if TTL reaches 0.
- Uses
NetworkInterfaceto send datagrams to next hop or destination.
- Language: C++20
- Build System: CMake
Course: CS144: Computer Networking (Stanford University)
Quarter: Winter 2025