UNIT-IV
Transport Layer
o The transport layer is a 4th layer from the top.
o The main role of the transport layer is to provide the communication services directly to
the application processes running on different hosts.
o The transport layer provides a logical communication between application processes
running on different hosts. Although the application processes on different hosts are not
physically connected, application processes use the logical communication provided by
the transport layer to send the messages to each other.
o The transport layer protocols are implemented in the end systems but not in the network
routers.
o A computer network provides more than one 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.
o All transport layer protocols provide multiplexing/demultiplexing service. It also
provides other services such as reliable data transfer, bandwidth guarantees, and delay
guarantees.
o 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.
1
Services provided by the Transport Layer
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:
o End-to-end delivery
o Addressing
o Reliable delivery
o Flow control
o Multiplexing
End-to-end delivery:
The transport layer transmits the entire message to the destination. Therefore, it ensures the end-
to-end delivery of an entire message from a source to the destination.
Reliable delivery:
The transport layer provides reliability services by retransmitting the lost and damaged packets.
Flow Control
Flow control is used to prevent the sender from overwhelming the receiver. If the receiver is
overloaded with too much data, then the receiver discards the packets and asking for the
retransmission of packets. This increases network congestion and thus, reducing the system
performance. The transport layer is responsible for flow control. It uses the sliding window
protocol that makes the data transmission more efficient as well as it controls the flow of data so
2
that the receiver does not become overwhelmed. Sliding window protocol is byte oriented rather
than frame oriented.
Multiplexing
The transport layer uses the multiplexing to improve transmission efficiency.
Multiplexing can occur in two ways:
o Upward multiplexing: Upward multiplexing means multiple transport layer connections
use the same network connection. To make more cost-effective, the transport layer sends
several transmissions bound for the same destination along the same path; this is
achieved through upward multiplexing.
o Downward multiplexing: Downward multiplexing means one transport layer connection
uses the multiple network connections. Downward multiplexing allows the transport
layer to split a connection among several paths to improve the throughput. This type of
multiplexing is used when networks have a low or slow capacity.
3
Addressing
o According to the layered model, the transport layer interacts with the functions of the
session layer. Many protocols combine session, presentation, and application layer
protocols into a single layer known as the application layer. In these cases, delivery to the
session layer means the delivery to the application layer. Data generated by an
application on one machine must be transmitted to the correct application on another
machine. In this case, addressing is provided by the transport layer.
o The transport layer provides the user address which is specified as a station or port. The
port variable represents a particular TS user of a specified station known as a Transport
Service access point (TSAP). Each station has only one transport entity.
o The transport layer protocols need to know which upper-layer protocols are
communicating.
4
Transport Layer protocols
The transport layer is represented by three protocols: TCP , UDP and [Link] mainly
UDP and TCP are important.
UDP Protocol-
UDP is short for User Datagram Protocol.
It is the simplest transport layer protocol.
It has been designed to send data packets over the Internet.
It simply takes the datagram from the network layer, attaches its header and sends it
to the user
Characteristics of UDP-
It is a connectionless protocol.
It is a stateless protocol.
It is an unreliable protocol.
It is a fast protocol.
It offers the minimal transport service.
It is almost a null protocol.
It does not guarantee in order delivery.
It does not provide congestion control mechanism.
It is a good protocol for data flowing in one direction.
Need of UDP-
TCP proves to be an overhead for certain kinds of applications.
The Connection Establishment Phase, Connection Termination Phase etc of TCP are
time consuming.
To avoid this overhead, certain applications which require fast speed and less overhead
use UDP.
5
User Datagram Format
The user datagram has a 16-byte header which is shown below:
Where,
o Source port address: It defines the address of the application process that has delivered
a message. The source port address is of 16 bits address.
o Destination port address: It defines the address of the application process that will
receive the message. The destination port address is of a 16-bit address.
o Total length: It defines the total length of the user datagram in bytes. It is a 16-bit field.
o Checksum: The checksum is a 16-bit field which is used in error detection.
Disadvantages of UDP protocol
o UDP provides basic functions needed for the end-to-end delivery of a transmission.
o It does not provide any sequencing or reordering functions and does not specify the
damaged packet when reporting an error.
o UDP can discover that an error has occurred, but it does not specify which packet has
been lost as it does not contain an ID or sequencing number of a particular data segment.
Applications Using UDP-
Following applications use UDP-
Applications which require one response for one request use UDP. Example- DNS.
Routing Protocols like RIP and OSPF use UDP because they have very small amount of
data to be transmitted.
Trivial File Transfer Protocol (TFTP) uses UDP to send very small sized files.
Broadcasting and multicasting applications use UDP.
6
Streaming applications like multimedia, video conferencing etc use UDP since they
require speed over reliability.
Real time applications like chatting and online games use UDP.
Management protocols like SNMP (Simple Network Management Protocol) use UDP.
Bootp / DHCP uses UDP.
Other protocols that use UDP are- Kerberos, Network Time Protocol (NTP), Network
News Protocol (NNP), Quote of the day protocol etc.
TCP
o TCP stands for Transmission Control Protocol.
o It provides full transport layer services to applications.
o 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
o Stream data transfer: TCP protocol transfers the data in the form of contiguous stream
of bytes. TCP group the bytes in the form of TCP segments and then passed it to the IP
layer for transmission to the destination. TCP itself segments the data and forward to the
IP.
o Reliability: TCP assigns a sequence number to each byte transmitted and expects a
positive acknowledgement from the receiving TCP. If ACK is not received within a
timeout interval, then the data is retransmitted to the destination.
The receiving TCP uses the sequence number to reassemble the segments if they arrive
out of order or to eliminate the duplicate segments.
o Flow Control: When receiving TCP sends an acknowledgement back to the sender
indicating the number the bytes it can receive without overflowing its internal buffer. The
number of bytes is sent in ACK in the form of the highest sequence number that it can
receive without any problem. This mechanism is also referred to as a window
mechanism.
o Multiplexing: Multiplexing is a process of accepting the data from different applications
and forwarding to the different applications on different computers. At the receiving end,
the data is forwarded to the correct application. This process is known as demultiplexing.
7
TCP transmits the packet to the correct application by using the logical channels known
as ports.
o Logical Connections: The combination of sockets, sequence numbers, and window
sizes, is called a logical connection. Each connection is identified by the pair of sockets
used by sending and receiving processes.
o Full Duplex: TCP provides Full Duplex service, i.e., the data flow in both the directions
at the same time. To achieve Full Duplex service, each TCP should have sending and
receiving buffers so that the segments can flow in both the directions. TCP is a
connection-oriented protocol. Suppose the process A wants to send and receive the data
from process B. The following steps occur:
o Establish a connection between two TCPs.
o Data is exchanged in both the directions.
o The Connection is terminated.
TCP Segment Format
1. Source Port-
Source Port is a 16 bit [Link] identifies the port of the sending application.
8
2. Destination Port- Destination Port is a 16 bit [Link] identifies the port of the receiving
application.
3. Sequence Number-Sequence number is a 32 bit [Link] assigns a unique sequence number
to each byte of data contained in the TCP [Link] field contains the sequence number of
the first data byte.
4. Acknowledgement Number-Acknowledgment number is a 32 bit [Link] contains sequence
number of the data byte that receiver expects to receive next from the [Link] is always
sequence number of the last received data byte incremented by 1.
5. Header Length-Header length is a 4 bit [Link] contains the length of TCP header.
It helps in knowing from where the actual data begins.
Minimum and Maximum Header length-
The length of TCP header always lies in the range-[20 bytes , 60 bytes]
The initial 5 rows of the TCP header are always used.
So, minimum length of TCP header = 5 x 4 bytes = 20 bytes.
The size of the 6th row representing the Options field vary.
The size of Options field can go up to 40 bytes.
So, maximum length of TCP header = 20 bytes + 40 bytes = 60 bytes.
6. Reserved Bits-The 6 bits are [Link] bits are not used.
7. URG Bit- URG bit is used to treat certain data on an urgent basis.
When URG bit is set to 1,
It indicates the receiver that certain amount of data within the current segment is urgent.
Urgent data is pointed out by evaluating the urgent pointer field.
The urgent data has be prioritized.
Receiver forwards urgent data to the receiving application on a separate channel.
8. ACK Bit-
ACK bit indicates whether acknowledgement number field is valid or not.
When ACK bit is set to 1, it indicates that acknowledgement number contained in the
TCP header is valid.
For all TCP segments except request segment, ACK bit is set to 1.
Request segment is sent for connection establishment during Three Way Handshake.
9. PSH Bit-
PSH bit is used to push the entire buffer immediately to the receiving application.
When PSH bit is set to 1,
All the segments in the buffer are immediately pushed to the receiving application.
No wait is done for filling the entire buffer.
9
This makes the entire buffer to free up immediately.
10. RST Bit-
RST bit is used to reset the TCP connection.
When RST bit is set to 1,
It indicates the receiver to terminate the connection immediately.
It causes both the sides to release the connection and all its resources abnormally.
The transfer of data ceases in both the directions.
It may result in the loss of data that is in transit.
This is used only when-
There are unrecoverable errors.
There is no chance of terminating the TCP connection normally.
11. SYN Bit-
SYN bit is used to synchronize the sequence numbers.
When SYN bit is set to 1,
It indicates the receiver that the sequence number contained in the TCP header is the
initial sequence number.
Request segment sent for connection establishment during Three way handshake contains
SYN bit set to 1.
12. FIN Bit-
FIN bit is used to terminate the TCP connection.
When FIN bit is set to 1,
It indicates the receiver that the sender wants to terminate the connection.
FIN segment sent for TCP Connection Terminationcontains FIN bit set to 1.
13. Window Size-
Window size is a 16 bit field.
It contains the size of the receiving window of the sender.
It advertises how much data (in bytes) the sender can receive without acknowledgement.
Thus, window size is used for Flow Control.
14. Checksum-
10
Checksum is a 16 bit field used for error control.
It verifies the integrity of data in the TCP payload.
Sender adds CRC checksum to the checksum field before sending the data.
Receiver rejects the data that fails the CRC check.
15. Urgent Pointer-
Urgent pointer is a 16 bit field.
It indicates how much data in the current segment counting from the first data byte is
urgent.
Urgent pointer added to the sequence number indicates the end of urgent data byte.
This field is considered valid and evaluated only if the URG bit is set to 1.
16. Options-
Options field is used for several purposes.
The size of options field vary from 0 bytes to 40 bytes.
Options field is generally used for the following purposes-
1. Time stamp
2. Window size extension
3. Parameter negotiation
4. Padding
Addressing
TCP communication between two remote hosts is done by means of port numbers (TSAPs).
Ports numbers can range from 0 – 65535 which are divided as:
System Ports (0 – 1023)
User Ports ( 1024 – 49151)
Private/Dynamic Ports (49152 – 65535)
Connection Management
TCP communication works in Server/Client model. The client initiates the connection and the
server either accepts or rejects it. Three-way handshaking is used for connection management.
11
Establishment
Client initiates the connection and sends the segment with a Sequence number. Server
acknowledges it back with its own Sequence number and ACK of client’s segment which is one
more than client’s Sequence number. Client after receiving ACK of its segment sends an
acknowledgement of Server’s response.
Release
Either of server and client can send TCP segment with FIN flag set to 1. When the receiving
end responds it back by ACKnowledging FIN, that direction of TCP communication is closed
and connection is released.
12
SCTP
SCTP stands for Stream Control Transmission [Link] is a connection- oriented protocol
in computer networks which provides a full-duplex association i.e., transmitting multiple
streams of data between two end points at the same time that have established a connection in
network. It is sometimes referred to as next generation TCP or TCPng, SCTP makes it easier to
support telephonic conversation on Internet. A telephonic conversation requires transmitting of
voice along with other data at the same time on both ends, SCTP protocol makes it easier to
establish reliable connection.
Characteristics of SCTP :
1. Unicast with Multiple properties –
It is a point-to-point protocol which can use different paths to reach end host.
2. Reliable Transmission –
It uses SACK and checksums to detect damaged, corrupted, discarded, duplicate and
13
reordered data. It is similar to TCP but SCTP is more efficient when it comes to
reordering of data.
3. Message oriented –
Each message can be framed and we can keep order of datastream and tabs on structure.
For this, In TCP, we need a different layer for abstraction.
4. Multi-homing –
It can establish multiple connection paths between two end points and does not need to
rely on IP layer for resilience.
Advantages of SCTP :
1. It is a full- duplex connection i.e. users can send and receive data simultaneously.
2. It allows half- closed connections.
3. The message’s boundaries are maintained and application doesn’t have to split
messages.
4. It has properties of both TCP and UDP protocol.
5. It doesn’t rely on IP layer for resilience of paths.
Disadvantages of SCTP :
1. One of key challenges is that it requires changes in transport stack on node.
2. Applications need to be modified to use SCTP instead of TCP/UDP.
3. Applications need to be modified to handle multiple simultaneous streams.
Difference between SCTP VS TCP VS UDP
14
15