Transport Layer Principles and Protocols Notes

  • Goal: Provide logical communication between application processes running on different hosts, ensuring data integrity and order during transmission.

  • Sender Action: Breaks application messages into smaller segments to facilitate easier handling during transmission and passes them to the network layer for routing.

  • Receiver Action: Reassembles the received segments back into original messages based on sequence information before delivering them to the application layer.

  • Transport vs. Network Layer:

    • Network Layer: Focuses on logical communication between hosts, handling the routing of packets across the network and dealing with complex network topologies.

    • Transport Layer: Provides logical communication between processes on hosts, ensuring that message delivery is reliable, ordered, and error-checked, which enhances the basic services provided by the network layer.

  • Available Internet Protocols:

    • TCP (Transmission Control Protocol): Offers reliable, in-order delivery of data, implementing mechanisms for congestion control, flow control, and connection establishment through a handshake process. TCP is widely used for applications where data integrity is crucial, such as web browsing and file transfers.

    • UDP (User Datagram Protocol): Provides an unreliable, unordered delivery mechanism, making it a lightweight protocol ideal for real-time applications such as streaming services, gaming, and DNS queries that prioritize speed over reliability.

    • Delay or Bandwidth Guarantees: Neither TCP nor UDP can provide specific guarantees regarding delay or bandwidth, instead depending on the underlying network characteristics.

Multiplexing and Demultiplexing

  • Multiplexing: The sender collects data from multiple sockets, allowing simultaneous connections, and adds transport layer headers to each segment for identification during demultiplexing at the receiver's end.

  • Demultiplexing: Ensures that the host delivers received segments to the appropriate socket based on header information. The process relies on distinguishing characteristics of each segment.

  • Connectionless Demultiplexing (UDP):

    • Utilizes only the destination port number to determine the appropriate socket. This allows multiple applications to listen on the same port as long as they differentiate based on the source IP/port.

  • Connection-Oriented Demultiplexing (TCP):

    • Employs a unique 44-tuple consisting of Source IP, Source Port, Destination IP, and Destination Port to identify each TCP connection, allowing servers to handle multiple simultaneous connections efficiently.

Connectionless Transport: UDP (RFC 768)

  • Characteristics: Known for its 'best effort' service, UDP allows segments to be lost or arrive out of order, which is acceptable in scenarios where timely delivery is prioritized over completeness.

  • Advantages: The protocol eliminates the need for connection establishment (thus avoiding round-trip time delays), maintains a small header size (8 bytes), and imposes no restrictions on the speed of data transmission, leading to lower latency in applications.

  • Typical Usage: Frequently utilized in applications supporting streaming multimedia, DNS lookups, simple network management protocol (SNMP), and HTTP/3 for web communications, where speed is critical.

  • UDP Segment Header: Comprises a 3232-bit wide structure including Source Port, Destination Port, Length, and a Checksum for error detection.

  • UDP Checksum:

    • Goal: Detect errors caused by flipped bits in the transmitted data segment.

    • Sender Action: Treats the segment contents as a series of 1616-bit integers and performs a one’s complement sum across these integers.

    • Receiver Action: Recomputes the checksum upon segment reception; a mismatch indicates an error necessitating retransmission, although UDP does not guarantee correction.

Connection-Oriented Transport: TCP

  • Overview: Provides a point-to-point, reliable communication mechanism characterized by in-order byte stream delivery, full duplex communication, and a robust handshaking procedure to establish connections before data transmission begins.

  • TCP Segment Structure:

    • Sequence Numbers: Used to track the order of bytes within a stream, ensuring that segments can be reconstructed precisely by the receiver.

    • Acknowledgment Numbers (ACKs): Indicate the next expected byte, enabling cumulative acknowledgment of received segments to ensure reliability.

    • Flags: Include critical control information for connection management (RST, SYN, FIN) and congestion notification (P, C, E).

  • Flow Control:

    • The primary goal is to prevent the sender from overwhelming the receiver's buffer capacity, which could lead to data loss.

    • The receiver advertises the size of its available buffer through the rwndrwnd (receive window) field, allowing the sender to adjust its data transmission rate accordingly.

    • A default Receive Buffer size of 40964096 bytes is commonly employed, though this may vary based on operating system and application requirements.

Connection Management

  • 3-way Handshake:

    1. Step 1 (Client): The client initiates the connection by sending a TCP SYN message (with SYNbit=11, Seq=xx).

    2. Step 2 (Server): The server acknowledges the SYN message by responding with SYNACK (SYNbit=11, ACKbit=11, ACKnum=x+1x+1, Seq=yy), indicating its willingness to accept the connection.

    3. Step 3 (Client): Finally, the client acknowledges the server's response with an ACK (ACKbit=11, ACKnum=y+1y+1), at which point the connection is established and can optionally include data.

  • Closing a Connection: Each side of the connection, whether it be client or server, can initiate closure by sending a TCP segment with the FIN bit set to 11 to signal termination, requiring acknowledgment from the other side to complete the disconnection process safely.

Principles of Congestion Control

  • Congestion: Occurs when numerous sources transmit excessive data too quickly for the network to efficiently handle, causing long delays and potential packet loss due to buffer overflow at network devices.

  • End-to-End Congestion Control: This method relies on inferring congestion from observable packet loss and delay, without explicit feedback from routers, as employed by TCP.

  • Network-Assisted Congestion Control: Involves techniques where routers actively communicate congestion levels back to the sending devices, allowing for more refined control over data transmission rates (examples include Explicit Congestion Notification (ECN) and Asynchronous Transfer Mode (ATM)).

Questions & Discussion

  • Q: What happens if the network layer delivers data faster than the application layer removes data from socket buffers?

    • A: The receive buffer can become congested and fill up, leading to potential data loss. TCP effectively manages this situation through flow control mechanisms to prevent overflowing the buffer and maintain a stable data transmission rate.

  • Q: Will a 2-way handshake always work in a network?

    • A: No, due to potential variable delays, retransmitted messages, and message reordering which can lead to "half-open" connections where one side believes a connection exists while the other side does not.

  • Human Protocol Analogy:

    1. Confirmation query: On belay?

    2. Acknowledgment: Belay on.

    3. Activity commencement: Climbing.