Nowadays we can run multiple applications on a single device and can get multiple services. Data from each application packaged, transported and delivered to the right 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 devices communicate to make a decision on how to split data into segments, and how to make possible data sending without losing any Segment? It also decides the confirmation method about all the arrived segments 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 and 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 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 correctly deliver a frame between source and destination. The data delivery on the data link layer is known as node-to-node delivery. The Network Layer is responsible for delivery of datagram between two hosts. The Network layer requires an IP address for right delivery of packets between hosts.
The data communication on the internet has not defined the exchange of data between two nodes or between two hosts. Real communication takes place between two processes. Therefore we need process-to-process delivery of data. The transport layer is responsible for process-to-process delivery of a packet, part of a message, and from one process to another.
But, at any moment, several processes may be running 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 which made it possible to deliver the segments of data correctly among the multiple processes running on a particular host. A port number is a 16-bit address used to find any client-server program uniquely. The figure below illustrates the data delivery process over a network.
End-to-end Connection between hosts
End-to-end connection happens between two applications, for example, the facebook messenger. It just considers that the two ends are talking with one another without any knowledge about the network. It 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 delivery of data between hosts while UDP is an unreliable protocol because it is a stateless protocol which ensures best-effort delivery. UDP is suitable for the applications which have little concern with flow or error control and requires to send a bulk of data like video conferencing. It has often used in multicasting protocols.
Tracking Individual Conversations
The layer 4 is responsible for data flowing between a 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 one or more 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 sending them to the projected receiver, the enveloping process is called multiplexing. Multiplexing allows the real-time use of different applications over a network which is running on a host. The transport layer provides a multiplexing mechanism to enables sending packet streams from various applications simultaneously over a network.
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, called de-multiplexing. De-multiplexing required at the receiver side to get the data coming from several processes. Transport layer receives the segments of data from the network layer and delivers it to the appropriate process running on the receiver’s machine.
Segmenting Data and Reassembling Segments
Most networks have the limit of data amount that can be included in a single packet. The transport layer protocols segment the data into blocks that are a suitable size according to the network limitations. This segmenting service also includes the encapsulation requirement on all piece of data. It also includes the header which is necessary for racking and resembling the data stream.
At the destination side, the transport layer reconstructs different segments of data into a complete data stream that is also useful to the application layer. The protocols at the transport layer also explain how header information used to rebuild the data pieces into streams to passed to the application layer.
Identifying the Applications
To pass data to the correct applications, the transport layer has the ability to recognize the target application. It assigns all application a unique port numbers to recognize.
Congestion often occurs in the network layer when the data traffic is so heavy that 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 re-transmission of lost packets from the sources increases the congestion further. 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 the congestion in a network once it occurred. 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, computing checksums, and also checks whether the received data is free of errors or contain some error. It uses the ACK and NACK services to inform the sender if the data arrives or not and checks for the integrity of data.
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.
TCP prevents data loss due to a fast sender and slow receiver by imposing flow control techniques. It uses the sliding window protocol which accomplished the receiver, sending a window back to the sender informing the size of data it can receive.
One complete stream can consume all the existing bandwidth across a network. The stream prevents other communications from occurring at the same time. This will also make difficult error recovery and retransmission of damaged data.
The transport or layer 4 segmenting the data into many 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.
Different applications have different transport reliability requirements. It specifies how to transfer data between different 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 structure, addressing, and routing of packets. 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, which ensures that all the data arrives at the destination side. In other hands, UDP is a simple transport protocol that does not give any reliability.