1.TCP & UDP
Module Overview
Module Title: Transport Layer
Prepared by: Divya KS
Institution: Adi Shankara Institute of Engineering & Technology, Kalady
Transport Layer
The core of the entire protocol hierarchy
Provides reliable and cost-effective data transport from source to destination machines, independent of the physical network utilized.
The Transport Service
Defines the service provided to the Application Layer.
Two types of transport services:
Connection-oriented transport service: Utilizing TCP (Transmission Control Protocol).
Connectionless transport service: Utilizing UDP (User Datagram Protocol).
Applications: Client-server computing and streaming multimedia.
Differences from the Network Layer:
Transport code operates on user machines
Network layer mainly on routers operated by carriers.
Services Provided to Upper Layers
Primary goal: Provide efficient, reliable, and cost-effective service to users (application processes).
Utilizes network layer services.
Transport Entity: Hardware/software that performs tasks in the transport layer. Can exist in:
Operating system kernel
Separate user process
Library package bound into network apps
Network interface card.
Logical Relationship of Layers
Host-to-Host Relationship:
Application Layer: Acts as user interface for applications.
Transport Layer: Ensures delivery and integrity of messages.
Network Layer: Handles routing and addressing of packets.
Transport Protocol Data Unit (TPDU)
Definition: Messages exchanged between transport entities.
Nested structure:
TPDUs within packets exchanged by the Network Layer.
Packets within frames exchanged by the Data Link Layer.
Process flow: Headers processed at each layer, data passed on up the stack.
Transport Service Primitives
Allow application programs to access transport services.
Examples of primitives in a simple transport service:
LISTEN: Server awaits incoming connections.
CONNECT: Client initiates a connection request.
SEND: Data transfer initiation.
RECEIVE: Awaiting data reception.
DISCONNECT: Deletes connection information when terminated.
Port Addressing
Necessity for addressing data effectively:
Data Link Layer: MAC addresses
Network Layer: IP addresses
Transport Layer: Port numbers (0-65,535) to identify multiple processes on a host.
Port Categories:
Well-Known Ports (0-1023): Assigned and controlled by ICANN.
Registered Ports (1024-49151): Can be registered to prevent collisions.
Dynamic Ports (49152-65535): Used as temporary or private.
Socket Addresses
A transport-layer protocol needs both the IP address and port number.
Socket Address: Combination of IP and port number identifying client and server processes.
Transport Layer Protocols
Two main protocols:
UDP (Connectionless Protocol): Unreliable, minimal overhead, suitable for small messages, does not ensure order of arrival.
TCP (Connection-oriented Protocol): Reliable, maintains order, requires connection establishment, and provides error checking and flow control.
UDP Overview
Definition: Connectionless, unreliable transport protocol.
Characteristics:
Simple and minimal overhead.
Suitable for scenarios requiring fast delivery without delivery guarantees (e.g., multimedia).
Constant header of 8 bytes, consisting of source port, destination port, length, and an optional checksum.
Applications of UDP
Suitable for applications such as:
RPC (Remote Procedure Call).
RTTP (Real-time Transport Protocol).
TCP Overview
Definition: Transmission Control Protocol, connection-oriented.
Features:
Reliable, with maintained order of transmitted data.
Supports full duplex communication and stream-oriented byte transmission.
TCP header consists of a fixed 20-byte structure, with various fields detailing the connection parameters.
TCP Segment Structure
Contains fields such as:
Source/Destination Port
Sequence Number
Acknowledgment Number
Window Size
Uses bits for flags (URG, ACK, PSH, RST, FIN, SYN) to manage connections and data flow.
TCP vs. UDP
TCP: Connection-oriented, reliable, in-order delivery of packets, suitable for critical applications like file transfer.
UDP: Connectionless, faster without guaranteed delivery, used in applications where speed is prioritized over reliability.
TCP Connection Management Phases
Connection Establishment: Three-way handshaking to initiate a TCP connection.
Data Transfer: Simultaneous two-way data flow until completion.
Connection Termination: Proper closure of the connection with four segments ensuring both sides agree on the disconnection.
Congestion Control in TCP
Techniques to monitor and control data transmission based on network conditions.
Phases for Handling Congestion:
Slow Start: Exponentially increases congestion window.
Congestion Avoidance: Linear increase of window size.
Congestion Detection: Reacts to lost packets based on timeout or duplicate acknowledgments.