Transport Layer (Layer 4 of the OSI Model)

We can run multiple applications on a single device and get various services. Data from each application is packaged, transported, and delivered to the proper application on the destination device. The transport layer of the OSI model accepts data from the application Layer and prepares it for network layer addressing.

A sending and receiving device communicates to decide how to split data into segments and how to make data sending possible without losing any Segment. It also determines the confirmation method for all the segments that have arrived at the receiving end.

The transport layer is responsible for end-to-end communication over a physical network. It provides logical communication between application processes running on different hosts within a layered architecture of protocols and other network components.

The Transport layer is responsible for end-to-end connectivity between hosts, Process to process delivery, error control, flow control, etc. It is also known as an end-to-end layer because it provides an end-to-end connection rather than a hop-to-hop connection. The transport layer is also responsible for data encapsulation. The unit of data encapsulation in the Transport Layer is a segment. It uses TCP, UDP, DCCP and SCTP protocols. The important responsibilities of a Transport Layer are the following:

Transport Layer process-to-process delivery

The Data Link Layer provides delivery of data frames between two neighbouring nodes over a link. It requires the 48-bit MAC address of the Network Interface Card of every host machine to deliver a frame between source and destination correctly. The data delivery on the data link layer is known as node-to-node delivery. The Network Layer is responsible for the delivery of data between two hosts. The Network layer requires an IP address to deliver packets between hosts.

Data communication on the internet does not define the exchange of data between two nodes or between two hosts. Real communication takes place between two processes. Therefore, we need process-to-process data delivery. The transport layer is responsible for the process-to-process delivery of a packet, part of a message, and from one process to another.

But, at any moment, several processes may run on the source host and several on the destination host. To complete the delivery, we need a mechanism to deliver data from one of these processes running on the source host to the corresponding process running on the destination host.

So, the port number is the mechanism that makes it possible to deliver the data segments correctly among the multiple processes running on a particular host. A port number is a 16-bit address used to uniquely identify any client-server program. The figure below illustrates the data delivery process over a network.

Transport Layer

End-to-end Connection between hosts

End-to-end connection happens between two applications, for example, Facebook Messenger. It just considers that the two ends are talking with one another without any knowledge about the network. It is usually a transport layer responsibility. It uses TCP and UDP protocols for end-to-end connectivity.

TCP is a reliable protocol because it ensures reliable data delivery between hosts. At the same time, UDP is unreliable because it is a stateless protocol that provides best-effort delivery. UDP is suitable for applications that have little concern with flow or error control and require sending bulk data, such as video conferencing. It is often used in multicasting protocols.

Tracking Individual Conversations

Layer 4 is responsible for data flowing between source and destination applications, known as a conversation. A host may have numerous applications running across the network simultaneously. All applications communicate with one or more applications on remote hosts. It is the task of the transport or layer 4 to keep up and track these multiple conversations.

Multiplexing and De-Multiplexing

It collects data from several application processes of the sender, envelops the data with a header, and sends it to the projected receiver. The enveloping process is called multiplexing. Multiplexing allows the real-time use of different applications over a network running on a host. The transport layer provides a multiplexing mechanism to enable sending packet streams from various applications simultaneously over a network.

The transport layer at the receiving end accepts the data packets from different processes differentiated by their port numbers and passes them to the network layer after adding proper headers. In the same way, delivering received segments at the receiver side to the correct app layer processes is called de-multiplexing. De-multiplexing is required on the receiver side to get the data from several methods. The transport layer receives the data segments from the network layer and delivers them to the appropriate process running on the receiver’s machine.

Segmenting Data and Reassembling Segments

Most networks have a limit on the amount of data that can be included in a single packet. The transport layer protocols segment the data into blocks of a suitable size according to the network limitations. This segmenting service also consists of the encapsulation requirement on all pieces of data. It also includes the header necessary for racking and resembling the data stream.

On the destination side, the transport layer reconstructs different data segments into a complete data stream useful to the application layer. The protocols at the transport layer also explain how header information is used to rebuild the data pieces into streams to be passed to the application layer.

Identifying the Applications

The transport layer can recognize the target application to pass data to the correct applications. It assigns unique port numbers to all applications for recognition.

Congestion Control

Congestion often occurs in the network layer when the data traffic is so heavy that it slows down network response time. Due to many sources over a network, attempt to send data and the router buffers start overflowing due to which loss of packets occurs. As a result, the re-transmission of lost packets from the sources further increases congestion. So, the transport layer provides Congestion Control in different ways.

It uses open-loop congestion control to prevent congestion and closed-loop congestion control to remove congestion in a network once it occurs. TCP also provides AIMD—additive increase multiplicative decrease, leaky bucket technique for congestion control.

Data integrity and Error correction

Layer 4 also checks errors in the data coming from the application layer. It uses error detection codes and computing checksums to check whether the received data is error-free or contains some error. It uses the ACK and NACK services to inform the sender if the data arrives and checks for its integrity.

Flow control

Layer 4 also provides a flow control mechanism between the source and destination host. The flow control ensures the data rate at which a sender is transmitting. It ensures the data-sending speed according to the speed of the receiver’s receiving capabilities. It is used to manage the flow of data/packets among two different nodes, especially in cases where the sending device can send data faster than the receiver can take in.

By imposing flow control techniques, TCP prevents data loss due to a fast sender and slow receiver. It uses the sliding window protocol, which allows the receiver to send a window back to the sender, informing the data size it can receive.

Conversation Multiplexing

One complete stream can consume all the existing bandwidth across a network. The stream prevents other communications from occurring at the same time, which will also make error recovery and retransmission of damaged data difficult.

The transport or layer 4 segmenting the data into smaller chunks enables many communications, from many users to multiplex on the same network.  Layer 4 adds a header to recognize each segment of data. The header fields enable various transport layer protocols to do different functions in managing data communication.

Reliability

Different applications have different transport reliability requirements. It specifies how to transfer data between other hosts. TCP/IP model provides two transport layer protocols:-

  • Transmission Control Protocol (TCP)
  • User Datagram Protocol (UDP)

The IP address is only concerned with the packets’ structure, address, and routing. It does not specify the delivery and transportation of the packets. IP address uses TCP and UDP to allow hosts to communicate and transfer data with each other. The figure below illustrates both TCP and UDP.

TCP is a reliable, full-featured transport protocol that ensures that all the data arrives at the destination side. In contrast, UDP is a simple transport protocol that does not provide reliability.

[qsm quiz=2]