The Transport layer is the fourth layer of the OSI model. This layer is responsible for end-to-end connectivity, Process to process delivery, error control, flow control etc. It is also called as an end-to-end layer because it provides a point-to-point connection rather then hop-to-hop, between the source host and destination host to transport the services reliably. The unit of data encapsulation in Transport Layer is a segment.
The protocols used by Transport Layer to improve its functionalities are TCP(Transmission Control Protocol), UDP( User Datagram Protocol), DCCP(Datagram Congestion Control Protocol), SCTP (Stream Control Transmission Protocol) etc. Different responsibilities of a Transport Layer are the following:
The process of process delivery
The data link layer is responsible for delivery of frames between two neighboring nodes over a link. Data Link Layer requires the MAC address (48 bits address contained inside the Network Interface Card of every host machine) of source-destination hosts to correctly deliver a frame. This is node-to-node delivery. The network layer is responsible for delivery of datagram between two hosts. The Network layer also requires the IP address for right routing of packets.
The internet communication has not defined as the exchange of data between two nodes or between two hosts. Real communication takes place between two processes. So that we need process-to-process delivery. The transport layer is responsible for process-to-process delivery, the 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 over a network.
End-to-end Connection between hosts
End-to-end connection happening between two applications (maybe you and your friend using a messenger like Skype or any other). It doesn’t care what’s in the middle, it just considers that the two ends are taking with one another. It generally is a Layer 4 responsibility.
For end-to-end connection layer 4 generally uses TCP and UDP protocols. TCP is a secure and connection- orientated protocol which uses a handshake to set up a connection between two end- hosts. TCP ensures reliable delivery of data and used in many applications.
On the other hand, UDP is a stateless and unreliable protocol which ensures best-effort delivery. It 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
At this layer, all set of data flowing between a source and destination applications known as a conversation. A host may have several applications that are communicating across the network simultaneously. All of these applications communicate with one or more applications on one or more remote hosts. It is the task of the transport layer to keep up and track these multiple conversations.
Multiplexing and Demultiplexing
Gathering data from several application processes of the sender, enveloping that data with a header and sending them to the intended receiver, called multiplexing. Multiplexing allows the real-time use of different applications over a network which is running on a host. The transport layer provides this mechanism which enables us to send packet streams from various applications simultaneously over a network.
Transport layer accepts these data packets from different processes differentiated by their port numbers and passes them to network layer after adding proper headers. in the same way, delivering received segments at the receiver side to the correct app layer processes, called demultiplexing. Demultiplexing required at the receiver side to get the data coming from various processes. Transport 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
Data should set to send through the media in suitable pieces. The majority of networks have the restriction on the amount of data that can be included in a single packet. The transport layer protocols have services that segment the data into blocks that are a suitable size. This service also includes the encapsulation need on all piece of data. A header necessary for racking and resembling the data stream.
At the destination side, the transport layer should be able to reconstruct the pieces of data into a complete data stream that is also useful to the application layer. The protocols at the transport layer explain how the transport layer 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 to recognize the target application. To do this, the transport layer assigns all application a port number. Each process accessing the network has assigned a unique port number.
Congestion occurring in network layer when the message traffic is so heavy and too many that it slows down network response time. Due to heavy and 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 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. TCP provides AIMD- additive increase multiplicative decrease, leaky bucket technique for congestion control.
Data integrity and Error correction
The transport layer is also responsible for checking errors in the messages coming from the application layer by using error detection codes; computing checksums; it checks whether the received data is free of errors and uses the ACK and NACK services to inform; the sender if the data arrives or not and checks for the integrity of data.
The transport layer also provides a flow control mechanism between the source and destination. The flow control ensures the rate at which a sender is transmitting is in proportion to the receiver’s receiving capabilities.
Flow control has used in data communications 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 the data loss due to a fast sender and slow receiver by imposing flow control techniques. It uses the method of sliding window protocol which accomplished the receiver, sending a window back to the sender informing the size of data it can receive.
To send some types of data across a network, as one complete stream can consume all the existing bandwidth. This will prevent other communications from occurring at the same time and this will also make difficult error recovery and retransmission of damaged data. The transport layer segmenting the data into many smaller chunks, enables many communications, from many users to multiplexed on the same network. So, to recognize each segment of data, the transport layer adds a header contain binary data organized into several fields. It is the values in these fields that enable various transport layer protocols to do different functions in managing data communication.
The transport layer is also liable for managing reliability. Different applications have different transport reliability requirements. 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. The transport layer protocols specify how to transfer data between hosts. TCP/IP model provides two transport layer protocols:-
- Transmission Control Protocol (TCP)
- User Datagram Protocol (UDP)
The figure illustrates the both TCP and UDP. IP address uses these transport protocols to allow hosts to communicate and transfer data with each other.
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.