Network Fundamentals: Protocols, Streaming, and Reliable Data Transfer

Core Networking Concepts

Circuit Switching Fundamentals

In circuit switching, first maximize the smallest link, then proceed to maximize the subsequent links.

Total Network Delay Components

Total delay is calculated as the sum of:

  • Processing/Nodal Delay
  • Queue Delay
  • Transmission Delay (Trans)
  • Propagation Delay (Prop)

Bandwidth-Delay Product (BDP)

The Bandwidth-Delay Product (BDP) represents how much data fits within the “pipe” (where delay is the length and bandwidth is the width). To find the number of pipes, divide the packet size by the BDP.

Data Encapsulation and Network Devices

The data unit transformation sequence is: Message → Segment → Datagram → Frame.

  • A Switch implements the Physical and Link layers.
  • A Router implements the Physical, Link, and Network layers.

Socket Identification

A socket is identified by the tuple: IP Address, Port, and Protocol.

Domain Name System (DNS) Structure

DNS is not centralized. It typically involves root server clusters with many replicas. The hierarchy involves Root, TLD (Top-Level Domain), and Authoritative servers.

DNS Query Process

A query typically starts locally, then pings the root server, then the TLD server, and finally the authoritative server.

DNS Record Types

DNS records consist of (Name, Value, Type, TTL):

  • A Record: Name = hostname, Value = IP address.
  • NS Record: Name = domain, Value = hostname of the authoritative DNS server for that domain.
  • CNAME Record: Name is an alias, Value is the canonical hostname.
  • MX Record: Value is the SMTP server associated with the name.

Hypertext Transfer Protocol (HTTP)

HTTP Connection Types

  • Non-Persistent HTTP: Requires two RTTs per file transfer.
  • Persistent HTTP: Transfers all files over one connection (1 RTT setup + 1 RTT per file).

Both types are affected by file transmission time.

HTTP Features and Evolution

Cookies are stored at protocol endpoints and carried within HTTP messages.

  • HTTP 1.1: Introduced persistent connections but suffered from Head-of-Line (HOL) blocking (First-Come, First-Served object serving, often exacerbated by TCP retransmission stalls).
  • HTTP/2: Fixed HOL blocking by dividing objects into smaller frames and scheduling those frames independently. However, parallel connections are still desired because TCP retransmission stalls can still occur.
  • HTTP/3: Adds security and congestion control, often utilizing QUIC.

Web Caching

All requests are funneled through the web cache, which acts as both a client and a server. Caching reduces institutional traffic and improves client response time. The Conditional GET method is commonly used for cache validation.

Video Streaming Challenges

In streaming, the client plays the early part of the video while the rest is being sent. Challenges include Jitter (delay variance) and overall delay, which can cause video frames to be received out of order relative to their original play time.

Playout Buffering

To mitigate jitter, Playout Buffering is used. The client maintains a buffer to ensure a sufficient number of needed frames are available before playback begins. The Playout Delay is the initial waiting time required for the buffer to fill adequately before playback starts.

Dynamic Adaptive Streaming over HTTP (DASH)

DASH is a modern streaming standard:

  1. The server divides the video into multiple chunks.
  2. Each chunk is encoded at different rates.
  3. These different rate encodings are stored in separate files, often replicated across various CDN nodes.

The Manifest File

A Manifest File (XML or JSON) provides the URLs for all chunks. It is used to select lower bitrate encodings when bandwidth is constrained.

Intelligent Client Behavior

The client periodically estimates bandwidth and chooses the best possible streaming rate from the manifest at any given time. The client is “intelligent,” determining:

  • WHEN to request a chunk (to prevent buffer starvation or overflow).
  • WHAT encoding rate to request.
  • WHERE to request the chunk from.

Therefore, modern streaming relies on DASH + Buffering + Encoding Management.

Content Distribution Networks (CDNs)

CDNs store and serve multiple copies of videos and other content at geographically distributed sites.

CDN Deployment Strategies

  • “Enter Deep”: Pushing CDN servers deep into many access networks.
  • “Bring Home”: A different approach utilizing a smaller number (tens) of larger clusters located in Points of Presence (POPs) near access networks.

In summary, CDNs use multiple servers, each holding video copies, spread across the world.

Transport Layer Protocols: TCP vs. UDP

Transmission Control Protocol (TCP)

TCP provides:

  • Reliable data transfer
  • In-order delivery
  • Congestion control
  • Flow control
  • Connection setup (three-way handshake)

A TCP socket is identified by a 4-tuple: (Source IP, Destination IP, Source Port, Destination Port).

User Datagram Protocol (UDP)

UDP is unreliable and unordered.

Shared Characteristics

Both TCP and UDP offer no delay or bandwidth guarantees.

Demultiplexing

UDP demultiplexing relies only on the destination port number.

UDP Checksum Calculation

To calculate the UDP checksum:

  1. Break the segment (including the pseudoheader) into 16-bit (2-byte) chunks. The checksum field is initially set to zero.
  2. If the segment length is odd, pad the end with zero bits.
  3. Compute the 1s complement sum of all 16-bit words.

UDP Header Structure

The standard UDP header fields (each 16 bits) are: Source Port, Destination Port, Length, and Checksum, followed by the Data Body.

Reliable Data Transfer (RDT) Protocols

RDT 1.0: Perfect Channel

Assumes a perfect channel (no bit errors, no packet loss).

  • Sender: Waits for a call from the application layer, creates a packet, and sends it.
  • Receiver: Waits for a packet, extracts the data, and delivers it to the application layer.

RDT 2.0: Handling Bit Errors

Assumes bit errors can occur. Recovery uses ACKs (Acknowledgments) and NAKs (Negative Acknowledgments), employing a Stop-and-Wait mechanism.

RDT 2.1: Handling Corrupt ACKs/NAKs

Adds a Sequence Number (0 or 1) to packets to handle potential corruption of ACKs/NAKs. This doubles the number of states.

RDT 2.2: NAK-Free Protocol

Eliminates NAKs. The receiver uses ACKs to indicate the sequence number of the last correctly received packet.

RDT 3.0: Handling Packet Loss

Introduces a Timer mechanism to handle packet loss.

  • Sender: Starts a timer immediately after sending a packet. If a timeout occurs while waiting, the sender resends the packet and restarts the timer.
  • The timer is stopped upon receiving a valid ACK.

RDT Utilization

Utilization is calculated as: (L/R) / (L/R + RTT), where L is packet length, R is transmission rate, and RTT is Round Trip Time.

Improving RDT 3.0: Pipelining

Pipelining improves utilization by increasing the number of sequence numbers and allowing multiple unacknowledged packets to be sent “in-flight.” This requires buffering at the sender and/or receiver.

Go-Back-N (GBN) Protocol

Go-Back-N is a pipelined protocol where the sender can transmit multiple packets without waiting for an acknowledgment, but if a packet is lost or corrupted, the sender retransmits that packet and all subsequent packets that were already sent.

gf8P3k580rVBaDcAAAAASUVORK5CYII=