Transport Layer

The transport layer provides logical communication for end-to-end application processes running on different hosts.

Two principal Internet transport protocols

Multiplexing and demultiplexing

  • Multiplexing as sender
    • handles data from multiple sockets and add transprot header
      • Each transport layer segement has source and destination port number header.
      • Each network layer datagram has source and destination IP address header.
  • Demultiplexing as receiver
    • Host uses IP address & port number to direct segment to appropriate socket.

TCP VS UDP: connection VS connectionless demultiplexing

Connectionless demultiplexing

  • UDP sockets are local and independent.
  • Demultiplexing is based on destination port.
  • Datagrams with the same destination port number, but different source IP addresses and source port numbers will be directed to the same socket at receiving host, only concerning destination port.

Connection-Oriented Demultiplexing

  • TCP sockets are linked together.
  • TCP socket is identified by 4 tuple:
    • source IP address
    • source port number
    • dest IP address
    • dest port number
  • Receiver uses all four values to direct segment to appropriate socket.
  • Server may support many simultaneous TCP sockets:
    • each socket is identified by its own 4-tuple.
    • each socekt is associated with a different client.

User Datagram Protocol (UDP)

  • “no-frills” or “bare-bones” transport protocol.
  • “best effort” service, UDP segments may be
    • lost
    • delivered out of order to app
  • connectionless
    • no handshaking between sender and receiver
    • each UDP segment is handled independently of others

UDP Format

  • Lightweight communication between processes
  • Avoid overhead of ordered and reliable delivery
    • No connection setup delay and in-kernel connection state
  • No congestion control
    • UDP can blast as fast as desired
    • can function in the face of congestion

UDP Advantage

  • Fine-grained control
    • UDP sends as soon as the application writes
  • No connection set-up delay
    • UDP sends without establishing a connection
  • No connection state in host OS
    • No buffers, parameters, sequence #, etc
  • Small header overhead
    • UDP header is only 8-bytes long

UDP Usecase

  • Streaming multimedia apps
  • DNS
  • HTTP/3 (if reliable transfer is needed over UDP)
    • added reliability and congestion control at application layer
    • Project on this concept: Reliable UDP Transport

UDP and TCP are implemented inside Kernel

  • A typical OS includes userspace and kernel space:
    • User space program:
      • Must communicate with the kernel for resource management.
    • Kernel space program:
      • Has full control over the hardware and manages system resources like memory, CPU scheduling, and I/O operations.
      • Runs in privileged mode.

UDP provides the flexibility

  • Each application can implement its own algorithms without the need of approval from the OS
  • Updating application is much easier than updating the kernel (OS)
    • Speeding up the development and implementation of new technology

Example: QUIC (Quick UDP Internet Connections)

QUIC is a transport-layer protocol developed by Google replacing TCP by using UDP:

  • provides faster connection establishment
  • improves congestion control
  • provides better performance in mobile and high-latency environments