Transport Layer
• The transport layer is a 4th layer from the
top.
• The main role of the transport layer is to
provide the communication services directly
to the application processes running on
different hosts.
• At the sender’s side: The transport layer receives data
(message) from the Application layer and then
performs Segmentation, divides the actual message into
segments, adds source and destination’s port numbers
into the header of the segment, and transfers the
message to the Network layer.
• At the receiver’s side: The transport layer receives data
from the Network layer, reassembles the segmented
data, reads its header, identifies the port number, and
forwards the message to the appropriate port in the
Application layer.
• The transport layer protocols are
implemented in the end systems but not in
the network routers.
• A computer network provides more than
one transport layer protocol to the network
applications.
• For example, TCP and UDP are two
transport layer protocols that provide a
different set of services to the network layer.
• All transport layer protocols provide multiplexing
/demultiplexing service.
• It also provides other services such as
reliable data transfer,
bandwidth guarantees,
and delay guarantees.
• Each of the applications in the application
layer has the ability to send a message by
using TCP or UDP.
• The application communicates by using
either of these two protocols.
• Both TCP and UDP will then communicate
with the internet protocol in the internet
layer.
• The applications can read and write to the
transport layer.
• Therefore, we can say that communication
is a two-way process.
Transport Layer Services
• The services provided by the transport layer
are similar to those of the data link layer.
• The data link layer provides the services
within a single network while the transport
layer provides the services across an
internetwork made up of many networks.
• The data link layer controls the physical layer
while the transport layer controls all the lower
layers.
• The services provided by the transport layer
protocols can be divided into five categories:
• Process to Process delivery
• End to End connection
• Reliable delivery
• Flow control
• Congestion Control
• Multiplexing
Process to Process delivery
• While Data Link Layer requires the MAC
address (48 bits address) of source-destination
hosts to correctly deliver a frame and
• the Network layer requires the IP address for
appropriate routing of packets, in a similar way
• Transport Layer requires a Port address to
correctly deliver the segments of data to the
correct process amongst the multiple processes
running on a particular host.
• A port address is a 16-bit address used to
identify any client-server program uniquely.
End to End connection
• The transport layer is also responsible for creating the
end-to-end Connection between hosts for which it mainly
uses TCP and UDP.
• TCP is a secure, connection-oriented protocol that uses a
handshake protocol to establish a robust connection between
two end hosts. TCP ensures reliable delivery of messages
and is used in various applications.
• UDP, on the other hand, is a stateless and unreliable
connectionless protocol that ensures best-effort delivery. It
is suitable for applications that have little concern with flow
or error control and requires sending the bulk of data like
video conferencing.
Reliable delivery
• The reliable delivery has four aspects:
Error Control
• The primary role of reliability is Error Control.
In reality, no transmission will be 100 percent
error-free delivery.
• Therefore, transport layer protocols are designed
to provide error-free transmission.
• The data link layer also provides the error
handling mechanism, but it ensures only
node-to-node error-free delivery. However,
node-to-node reliability does not ensure the
end-to-end reliability.
• The data link layer checks for the error between each network node . If an
error is introduced inside one of the routers, then this error will not be
caught by the data link layer. It only detects those errors that have been
introduced between the beginning and end of the link. Therefore, the
transport layer performs the checking for the errors end-to-end to ensure
that the packet has arrived correctly.
Sequence Control
• On the sending end, the transport layer is
responsible for ensuring that the message
received from the upper layers can be
segmented and used by the lower layers.
• On the receiving end, it ensures that the
various segments of a transmission can be
correctly reassembled.
Loss Control
• On the sending end, all the fragments of
transmission are given sequence numbers by a
transport layer.
• These sequence numbers allow the receivers
transport layer to identify the missing
segment.
Duplication Control
• The transport layer guarantees that no
duplicate data arrive at the destination.
• Sequence numbers are used to identify the
lost packets; similarly, it allows the receiver
to identify and discard duplicate segments.
Flow Control
• The transport layer provides a flow control
mechanism
• TCP also prevents data loss due to a fast
sender and slow receiver by imposing some
flow control techniques.
• It uses the method of sliding window protocol
which is accomplished by the receiver by
sending a window back to the sender informing
the size of data it can receive.
Congestion Control
• Congestion is a situation in which too many sources
over a network attempt to send data and the router
buffers start overflowing due to which loss of packets
occur.
• As a result retransmission of packets from the sources
increases the congestion further.
• In this situation, the Transport layer provides
Congestion Control in different ways.
• It uses open loop congestion control to prevent the
congestion and closed-loop congestion control to
remove the congestion in a network once it occurred
Multiplexing
• Multiplexing
Gathering data from multiple application
processes of the sender, enveloping that data
with a header, and sending them as a whole to
the intended receiver is called multiplexing.
• Demultiplexing
Delivering received segments at the receiver
side to the correct app layer processes is called
demultiplexing.
Abstract view of multiplexing and demultiplexing
Multiplexing and Demultiplexing are the services
facilitated by the transport layer of the OSI model.
Transmission Control Protocol
(TCP)
• TCP stands for Transmission Control Protocol.
• It is most widely used protocol for data
transmission in communication network such
as internet.
• It provides full transport layer services to
applications.
• It is a connection-oriented protocol means the
connection established between both the ends
of the transmission.
• For creating the connection, TCP generates a
virtual circuit between sender and receiver for
the duration of a transmission
Features of TCP protocol
• TCP is reliable protocol. That is, the receiver always
sends either positive or negative acknowledgement
about the data packet to the sender, so that the sender
always has bright clue about whether the data packet
is reached the destination or it needs to resend it.
• TCP ensures that the data reaches intended
destination in the same order it was sent.
• TCP is connection oriented. TCP requires that
connection between two remote points be established
before sending actual data.
• TCP provides error-checking and recovery mechanism.
• TCP provides process at one end communicate with
process running on other end.
• TCP provides flow control.
• TCP provides multiplexing.
• TCP provides Congestion Control
• TCP provides full duplex server, i.e. it can perform
roles of both receiver and sender.
• TCP communication between two remote hosts is done
by means of port numbers Ports numbers can range
from 0 – 65535
• TCP communication works in Server/Client model.
TCP HEADER FORMAT
• Source Port address
Source Port is a 16 bit field.
It identifies the port of the sending
application.
• Destination Port address
Destination Port is a 16 bit field.
It identifies the port of the receiving
application.
• Sequence Number-
Sequence number is a 32 bit field.
TCP assigns a unique sequence number to
each data segment
• Acknowledgement Number-
Acknowledgment number is a 32 bit field.
When the ACK flag is set, then this contains
the next sequence number of the data byte
segement and works as an acknowledgment
for the previous data received.
For example, if the receiver receives the
segment number 'x', then it responds 'x+1' as
an acknowledgment number.
• HLEN: It specifies the length of the header
indicated by the 4-byte words in the header.
The size of the header lies between 20 and 60
bytes. Therefore, the value of this field would
lie between 5 and 15.
• Reserved: It is a 6-bit field reserved for future
use, and by default, all are set to zero.
• Flags
There are six control bits or flags
• URG: It represents an urgent pointer. If it is set,
then the data is processed urgently.
• ACK: If the ACK is set to 0, then it means that
the data packet does not contain an
acknowledgment.
• PSH: If this field is set, then it requests the
receiving device to push the data to the
receiving application without buffering it.
• RST: If it is set, then it requests to restart a
connection.
• SYN: It is used to establish a connection
between the hosts.
• FIN: It is used to release a connection, and no
further data exchange will happen.
Window size
• It is a 16-bit field. It contains the size of data
that the receiver can accept. This field is used
for the flow control between the sender and
receiver and also determines the amount of
buffer allocated by the receiver for a segment.
The value of this field is determined by the
receiver.
• Checksum
It is a 16-bit field. This field is optional in UDP,
but in the case of TCP/IP, this field is
mandatory.
• Urgent pointer
It is a pointer that points to the urgent data
byte if the URG flag is set to 1. Urgent pointer
added to the sequence number indicates the
send of urgent data byte.
• Options
It provides additional options. The optional field
is represented in 32-bits.
• Options field is generally used for the following
purposes-
• Time stamp
• Window size extension
• Padding