In OSI suite, there are 7 layers and all layers provide different services. Today we are here with detailed information on one of the layers i.e. transport layer which provides process-to-process communication in OSI suite.
Transport Layer in Computer Networks is an end-to-end layer that is used to deliver messages to a host. In OSI model, the transport layer is located between the session layer and the network layer.
What is Transport Layer?
- Transport Layer is the fourth layer from the top in OSI Model which provides communication services to the application processes that are running on different hosts.
- Transport Layer provides the services to the session layer and it receives the services from the network layer.
- The services provided by transport layer include error correction as well as segmenting and desegmenting data before and after it’s sent on the network.
- Transport layer also provides the flow control functionality and ensures that segmented data is delivered across the network in the right sequence.
Note: The main duty of transport layer is to provide process-to-process communication.
Services Provided by Transport Layer
1. Process to Process Communication
Transport Layer is responsible for delivery of message to the appropriate process.
Transport Layer uses a port number to deliver the segmented data to the correct process amongst the multiple processes that are running on a particular host. A port number is a 16-bit address used by transport layer to identify any client-server program.
2. Multiplexing and Demultiplexing
The transport layer provides the multiplexing service to improve transmission efficiency in data communication. At the receiver side, demultiplexing is required to collect the data coming from different processes. Transport Layer provides Upward and Downward Multiplexing:
Upward multiplexing means multiple transport layer connections utilize the connection of the same network. Transport layer transmits several transmissions bound for the same destination along the same path in network.
Downward multiplexing means a transport layer connection utilizes the multiple connections. This multiplexing allows the transport layer to split a network connection among several paths to improve the throughput in the network.
3. Flow Control
- Flow control makes sure that the data is transmitted at a rate that is acceptable for both sender and receiver by managing data flow.
- The transport layer provides a flow control service between the adjacent layers of the TCP/IP model. Transport Layer uses the concept of sliding window protocol to provide flow control.
4. Data integrity
Transport Layer provides data integrity by:
- Detecting and discarding corrupted packets.
- Tracking of lost and discarded packets and re-transmitting them.
- Recognizing duplicate packets and discarding them.
- Buffering out-of-order packets until the missing packets arrive.
5. Congestion avoidance
- In network, if the load on the network is greater than the network load capacity, then the congestion may occur.
- Congestion Control refers to the mechanisms and techniques to control the congestion and keep the load below the capacity.
- The transport layer recognizes overloaded nodes and reduced flow rates and takes proper steps to overcome this.
Example of Transport Layer
Let us understand transport layer with the help of example.
Let us take an example of sending email.
- When we send an email then the email in OSI model each layer communicates to the corresponding layer of the receiver.
- So when the mail comes at transport layer on the sender side then the email is broken down into small segments. Then the broken segments are sent to network layer and transport layer also specifies the source and destination port.
- At the receiver side, transport layer reassembles all the segment to get the data and use the port number to identify the application to deliver data.
Working of Transport Layer
The transport layer receives the services from the network layer and then gives services to the session layer.
At the sender’s side: At the sender’s end, transport layer collect data from application layer i.e. message, and performs segmentation to divide the message into segments and then adds the port number of the source and destination in the header and sends that message to network layer.
At the receiver’s side: At the receiver’s end, transport layer collects data from network layer and then reassembles the segmented data and identifies the port number by reading its header to send that message to the appropriate port in the session layer.
Refer to the image below to see the working of Transport Layer.
Transport Layer Protocols
- UDP (User Datagram Protocol)
- TCP(Transmission Control Protocol)
- SCTP (Stream Control Transmission Protocol)
UDP
- Connectionless protocol
- Unreliable protocol
- UDP stands for User Datagram Protocol.
- UDP is one of the simplest transport layer protocols which provides nonsequenced data transmission functionality.
- UDP is considered as a connectionless transport layer protocol.
- This type of protocol is referred to be used when speed and size are more important than reliability and security.
- It is an end-to-end transport-level protocol that adds transport-level addresses, checksum error control, and length information to the data received from the upper layer.
- User datagram is the packet constructed by the UDP protocol
Format of User Datagram
Refer to the image below to see the header of the UDP packet consisting of four fields.
User datagrams have a fixed-size header of 8 bytes which is divided into four parts –
Source port address: It defines the source port number and it is 16 bits.
Destination port address: It defines the destination port number and it is 16 bits.
Total length: This field is used to define the total length of the user datagram which is the sum of header and data length in bytes. It is a 16-bit field.
Checksum: Checksum is also a 16-bit field to carry the optional error detection data.
UDP Services
- Process to Process Communication
- Connectionless Service
- Fast delivery of the message
- Checksum
Disadvantages
- UDP delivers basic functions required for the end-to-end transmission of data.
- It does not use any sequencing and does not identify the damaged packet while reporting an error.
- UDP can identify that an error has happened, but UDP does not identify which packet has been lost.
TCP
- Connection-oriented protocol
- Reliable protocol
- Provide error and flow control
- TCP stands for Transmission Control Protocol.
- TCP is a connection-oriented transport layer protocol.
- TCP explicitly defines connection establishment, data transfer, and connection tear-down phases to provide connection-oriented service for data transmission.
- TCP is the most commonly used transport layer protocol.
Features of TCP Protocol
- Stream data transfer
- Reliability
- Flow Control
- Error Control
- Multiplexing
- Logical Connections
- Full Duplex
TCP Segment Format
Refer to the image below to see the header of TCP Segment.
- Source port address is a 16-bit field that defines the port number of an application program that is sending the segment.
- Destination port address is a 16-bit field that defines the port number of an application program that is receiving the segment.
- Sequence number is a field of 32 bits that will define the number assigned to data’s first byte contained in the segment.
- Acknowledgement number is a 32-bit field that describes the next byte that the receiver is looking forward to receiving from sender.
- Header Length (HLEN) is a field of 4 bit that specify the number of 4-byte words in TCP header. The header length of TCP header can be between 20 to 60 bytes.
- Reserved is a field 6 bit that is reserved for future use.
- Control bits are 6 different independent control bits or flags in this field.
- There are six in the control field:
- URG: Urgent pointer
- ACK: Acknowledgement number
- PSH: Push request
- RST: Reset connection
- SYN: Sequence number Synchronization
- FIN: Connection termination
- Window Size is a 16-bit field that defines the size of the window of sending TCP in bytes.
- Checksum, 16-bit field contains checksum and is used for error detection.
- Urgent pointer is a 16 bit field. This flag is set when there is urgent data in the data segment.
- Options and padding can be up to 40 bytes field for optional information in TCP header.
SCTP
- SCTP stands for Stream Control Transmission Protocol.
- SCTP is one of the connection-oriented transport layer protocols.
- It allows the transmission of data between sender and receiver in full duplex mode.
- This protocol makes it simpler to build connections over a wireless network and to control multimedia data transmission.
Features of SCTP
- Unicast with Multiple Properties
- Reliable Transmission
- Message oriented
- Multi-homing
Computer networking is the backbone of the digital era. Enroll in our Free Computer Networking course & learn from industry experts.
Conclusion:
- Transport Layer is the fourth layer of TCP/IP suite which provides process-to-process communication
- Transport Layer provides process-to-process communication, data integrity, flow control, congestion avoidance, multiplexing, and demultiplexing services.
- UDP is Transport layer protocol that provides connectionless service.
- TCP and SCTP is Transport layer protocol that provides connection-oriented service.