CS2005 Networks and Operating Systems - Transport Layer II

Page 1: Introduction

  • Title: CS2005 Networks and Operating Systems Transport Layer II

  • Authors: J.F Kurose and K.W. Ross

  • Copyright: ©1996-2016

Page 2: Session Objectives

  • Understand Key Concepts:

    • Connection-oriented transport

    • Transmission Control Protocol (TCP)

    • TCP Segment Structure

    • Reliable data transfer

    • Flow control

    • Connection management

    • Congestion control

Page 3: Overview of Transport Layer Protocols

  • Transport layer provides logical communication between application processes on different hosts.

  • Implemented in end systems, not in network routers.

  • Two key transport protocols in the Internet:

    • TCP (Transmission Control Protocol)

    • UDP (User Datagram Protocol)

  • Services provided by transport layer to applications:

    • Process-Level Addressing

    • Multiplexing and Demultiplexing

    • Integrity Checking and Error Detection

    • Connection Management (TCP only)

    • Acknowledgments and Retransmissions

    • Flow Control

  • Socket Identification:

    • UDP socket: identified by a 2-tuple (destination IP address + destination port number).

    • TCP socket: identified by a 4-tuple (source IP address + source port number + destination IP address + destination port number).

Page 4: Connection-Oriented Transport (TCP)

  • TCP requires a handshake between two processes before data transfer begins.

  • TCP connection is logical; state resides only in the end systems and not in intermediate routers.

  • TCP provides:

    • Full-duplex service: simultaneous data flow in both directions.

    • Point-to-point connection: between a single sender and a single receiver.

  • The connection establishment follows a three-way handshake process:

    1. Client sends a TCP segment to establish a connection.

    2. Server responds with a connection acknowledgment segment.

    3. Client acknowledges the server’s connection acknowledgment.

Page 5: TCP Connection Details

  • A TCP connection has buffers, variables, and socket connections on both ends without allocation in network elements.

  • Data stream is passed through TCP’s send buffer, and segments sent to the network layer.

  • Maximum Segment Size (MSS) is determined by link layer frame size to ensure TCP segments fit into a single frame.

  • Each data chunk is paired with a TCP header to form TCP segments, which are encapsulated in IP datagrams.

  • Both sender and receiver maintain their own send and receive buffers.

Page 6: TCP Segment Structure

  • TCP segment fields: source and destination ports, checksum, sequence number, acknowledgment number, receive window, header length.

  • The sequence number identifies the byte-stream number of the segment's first byte.

  • Acknowledgment number represents the next byte the receiver expects.

  • The TCP header is typically 20 bytes long, allowing for an optional field for maximum segment size and other parameters.

  • Header flags:

    • ACK: acknowledgment segment.

    • SYN: connection initiation.

    • FIN: connection termination.

    • CWR, ECE: congestion notification flags.

    • PSH: push data to the upper layer immediately.

    • URG: urgent data indication.

Page 7: Sequence and Acknowledgment Numbers

  • Sequence Number Field

    • First byte's number in the segment.

  • Acknowledgment Number Field

    • Indicates the next byte expected from sender.

  • Example of sequence/acknowledgment with data segments and their corresponding numbers.

Page 8: Sequence and Acknowledgment Example

  • Client sends 'C' with seq 42 to server and receives 'C' back.

    • Client's segments:

      • Seq 42, ACK 79, payload 'C'.

      • Seq 43, ACK 80.

    • Server's segment:

      • Seq 79, ACK 43, payload 'C'.

Page 9: TCP Reliable Data Transfer

  • TCP ensures data stream integrity; data is uncorrupted, without gaps, duplication, or disorder.

  • Utilizes timeouts to manage lost segments and utilizes cumulative acknowledgments.

  • Potential issues with timeout settings affecting retransmissions.

Page 10: Fast Retransmit

  • Duplicate ACKs used to identify lost segments before timeouts occur.

  • Upon receiving three duplicate ACKs, fast retransmit is triggered for the presumed lost packet.

Page 11: TCP Flow Control

  • TCP uses flow control to match sending rates with receiving application rates.

  • Prevents overflow in the receiving buffer by utilizing a variable called the receive window (rwnd).

  • The receive window's size must always be managed within the limits of the receive buffer size.

Page 12: TCP Connection Management: Establishment

  • Connection establishment involves a three-step handshake:

    1. Client sends SYN segment with chosen initial sequence number.

    2. Server acknowledges with SYN-ACK, allocates buffers, and sets initial sequence.

    3. Client acknowledges server's SYN-ACK.

Page 13: TCP Connection Management: Termination

  • Either process can terminate a connection. Resources are deallocated upon closure.

  • Closure process entails following a four-segment exchange using FIN and ACK flags.

Page 14: TCP Congestion Control

  • Focuses on managing withdrawal from network congestion using a congestion window (cwnd).

  • Traffic sending rate is adjusted based on perceived congestion.

  • TCP uses an additive increase/multiplicative decrease method for managing sending rates.

Page 15: Why Use UDP?

  • UDP allows application-level control, quick data transmission without connection delays, and lower overhead.

  • Suitable for real-time applications that can tolerate some data loss.

  • Comparatively, TCP introduces delays due to connection establishment and tracks connection state, affecting performance with many clients.

Page 16: Session Objectives (Repeat)

  • Understand Key Concepts from the session about TCP

Page 17: Reading Topics

  • Topics covering TCP include:

    • TCP Connection

    • TCP Segment Structure

    • Reliable Data Transfer

    • Flow Control

    • Connection Management

    • Congestion Control