Module 4
Transport Layer
23-1 PROCESS-TO-PROCESS DELIVERY
The transport layer is responsible for process-to-
process delivery—the delivery of a packet, part of a
message, from one process to another. Two processes
communicate in a client/server relationship, as we will
see later.
Topics discussed in this section:
Client/Server Paradigm
Multiplexing and Demultiplexing
Connectionless Versus Connection-Oriented Service
Reliable Versus Unreliable
Three Protocols
Note
The transport layer is responsible for
process-to-process delivery.
Introduction
•Located to Transport Layer
between application & network layers
•Provides process-to-process communication
•Core of TCP/IP suite for end-to-end data transfer
•Logical connection between two application layers
Transport-Layer Services:
•Provides services to application layer
•Receives services from network layer
Figure 2 Types of data deliveries
Addressing: Port Numbers
Figure 23.2 Port numbers
Figure 23.3 IP addresses versus port numbers
ICANN Ranges:-Internet Corporation for Assigned Names and Numbers
Figure 23.5 Socket address
The combination of an IP address and a port number is called a socket
address.
•Combination of IP address + port number
•Identifies client & server processes uniquely
•Both client and server have socket addresses
Encapsulation and Decapsulation
•Encapsulation adds transport header at sender
•Data unit names: segment, packet, datagram
•Decapsulation removes header at receiver, delivers to app
Figure 23.6 Multiplexing and demultiplexing
•Multiplexing: many processes → one transport layer (sender)
•Demultiplexing: one transport layer → many processes (receiver)
Flow Control
•Prevents buffer overflow & data loss
•Delivery methods:
• Pushing: sender sends without request
Pushing vs Pulling Delivery
•
• Pulling: sender sends on receiver request
Pushing: Producer sends items whenever produced without consumer
request
•Pulling: Producer sends items only after consumer requests
•Flow Control: Needed to prevent consumer overload in pushing
23.13
Flow Control at Transport Layer
•Four entities: sender process, sender transport layer, receiver
transport layer, receiver process
•Sending process produces and pushes messages to sender
transport layer
•Sender transport layer consumes messages, encapsulates,
pushes to receiver transport layer
•Receiver transport layer consumes packets, decapsulates, waits
for application-layer pull request
23.14
Flow Control Signaling with Buffers
•Buffers hold packets at sender and receiver
•Full sender buffer signals application to pause sending
•Full receiver buffer signals sender transport layer to pause
sending
23.15
Figure 23.7 Error control
Error control at the transport layer is responsible for
1. Detecting and discarding corrupted packets.
2. Keeping track of lost and discarded packets and resending them.
3. Recognizing duplicate packets and discarding them.
4. Buffering out-of-order packets until the missing packets arrive.
Error Control in Transport Layer
•Internet’s network layer (IP) is unreliable, so transport layer adds
reliability
•Functions:
• Detect and discard corrupted packets
• Track and resend lost packets
• Recognize and discard duplicates
• Buffer out-of-order packets
23.17
Sequence Numbers
•Sequence numbers are sequential but limited by header size
•If header allocates m bits for sequence number:
• Numbers range from 0 to 2m − 1
Example:
• For m=4, sequence numbers = 0 to 15
• Sequence numbers wrap around after reaching max
Acknowledgment (ACK) Mechanism
•Receiver sends ACK for correctly received packets
•Sender uses timer to detect lost packets and retransmits if no ACK
received
•Duplicate packets discarded by receiver
•
23.18
Combining Flow and Error Control
•Two buffers: one at sender, one at receiver
•Packets stored in sender buffer until ACK received
•Receiver stores packets by sequence number until
application reads them
23.19
Sliding Window Protocol
•Allows multiple packets to be sent before waiting for ACK
•Window controls number of unacknowledged packets in transit
•Sequence numbers help avoid duplicates and detect missing packets
•Used in TCP for reliable, efficient data transfer
23.20
Congestion Control
•Congestion occurs when packet load > network capacity
•Routers/switches have limited input/output queues causing
delays
•Congestion control prevents overload by adjusting sending
rate
23.21
Connectionless vs Connection-Oriented Protocols
Connectionles Connection-
Feature
s Oriented
Connection
None Required
Setup
Packet
Not guaranteed Guaranteed
Ordering
Usually No Usually Yes
Reliability
(e.g., UDP) (e.g., TCP)
Flow/Error/
Typically
Congestion Supported
absent
Control
23.22
Connectionless Service
23.23
Connection-Oriented Service
23.24
Connectionless Protocol Behavior (FSM)
•Only one state: Established
•Always ready to send/receive packets
•No setup or teardown phases
23.25
Connection-Oriented Protocol Behavior (FSM)
•States: Closed → Open-wait-I → Open-wait-II →
Established → Close-wait-I → Close-wait-II → Closed
•Connection setup: open requests and
acknowledgments exchanged
•Data transfer in established state
•Connection teardown with close requests and
acknowledgments
23.26
Introduction to Transport Layer
•Acts as liaison between application layer and
network layer
•Provides process-to-process communication
•Responsible for reliability, flow control, error
23.27
Simple Protocol
•Connectionless, no flow or error control
•Sender sends packet if application has data
•Receiver delivers message immediately upon
packet arrival
•Very basic, unreliable
23.28
Stop-and-Wait Protocol
•Connection-oriented, uses flow & error control
•Sender sends one packet & waits for ACK
•Uses sequence numbers (0 or 1) to prevent duplicates
•Retransmits on timeout
•No pipelining → inefficient
23.29
Stop-and-Wait Protocol FSM (Simplified)
•Sender states:
• Ready: waits for app data
• Blocking: waits for ACK or timeout
•Receiver state:
• Ready: delivers messages on correct
packet arrival
23.30
23.31
Go-Back-N Protocol (GBN)
•Sliding window protocol with window size > 1
•Sender can send multiple packets before ACKs
•Receiver only accepts packets in order
•On timeout, sender resends all unacknowledged packets
•Uses cumulative ACKs
•ARQ:Automatic Repeat Request
23.32
GBN Windows and Timers
•Send window variables: Sf (first unacknowledged), Sn (next to send),
Ssize (window size)
•One timer for oldest outstanding packet
•Receiver window size = 1 (only accepts expected packet)
23.33
23.34
23.35
23.36
23.37
Selective Repeat Protocol (SR)
•Resends only lost/corrupted packets selectively
•Sender and receiver windows of same size (≤ 2^(m-1))
•Receiver buffers out-of-order packets
•Uses individual ACKs for each packet
•More efficient than GBN
23.38
SR Protocol Window Size Example
•Explain why window size ≤ 2^(m-1)
•Larger windows can cause errors with duplicate packets
23.39
Bidirectional Protocols: Piggybacking
•Data and ACKs flow both ways
•ACKs are included in outgoing data packets to improve
efficiency
•Used in bidirectional GBN and SR protocols
23.40
Figure 23.8 Position of UDP, TCP, and SCTP in TCP/IP suite
23-2 USER DATAGRAM PROTOCOL (UDP)
The User Datagram Protocol (UDP) is called a
connectionless, unreliable transport protocol. It does
not add anything to the services of IP except to provide
process-to-process communication instead of host-to-
host communication.
Topics discussed in this section:
Well-Known Ports for UDP
User Datagram
Checksum
UDP Operation
Use of UDP
Table 23.1 Well-known ports used with UDP
23.43
Figure 23.9 User datagram format
23.44
Note
UDP length
= IP length – IP header’s length
23.45
Figure 23.10 Pseudoheader for checksum calculation
23.46
Figure 23.12 Queues in UDP
23.47