Among the transport layer services, the most important is to provide end-to-end communication between the process running on a source host and the corresponding process running on the destination host. There may be several processes running on the source host at the same time and there may be several processes running on the destination host. It is the responsibility of the transport layer to identify which process on the source host is communicating with which process on the destination host.
The transport layer is a layer between the application layer and the network layer. The network layer provides services to the transport layer which in turn provides its services to the application layer. The responsibility of the network layer is to provide communication between the two hosts on the Internet.
But the actual communication is not between the hosts it is between the process running on the source host and the corresponding process running on the destination host. The transport layer controls the delivery of message process-to-process. The communicating processes maintain a client/server relation. Now let us discuss the functions or services that are provided by the transport layer.
Transport Layer Services
1. Process-to-Process Service
In networking, a process is considered as an entity of application layer that requires service of the transport layer to communicate with the process running on another host connected to the Internet.
Now a network layer does similar work as it also allows two hosts on the internet to communicate with each other. Then what is the difference? The network layer controls host-to-host communication. It does not have to do anything about from which process on the source host the message is from and it does not make any decision to which process on the destination host the message must be delivered.
However, this is the responsibility of the transport layer to recognize from which process on the source host the message is from and to which process on the destination host the message must be delivered. So a transport layer provides process-to-process data transfer.
2. Process Identifier
There are several hosts on the internet to identify a specific host on the internet we need its IP address. Now there may be several processes running on that host, to identify a specific process among several other processes we require another identifier which we refer to as the port number. In TCP/IP protocol suite the port number ranges between 0 and 65,535.
Now the client process is assigned the ephemeral port number which we refer to as a temporary port number and this number should be greater than 1,023. The client process is assigned a temporary port number because usually, a client process has a short life as they do not run for a long time.
On the other hand, the server processes are assigned a universal port number which is referred to as a well-known port number. Every client process is aware of the well-known port number of the corresponding server process. The well-known port numbers are always less than 1024.
The Internet Corporation for Assigned Names & Numbers (ICANN) has divided the range of port numbers 0 and 65,535 into three types.
- Well-known Ports: The well-known port number is universal port numbers ranging from 0 to 1,023 and are assigned by the ICANN.
- Register Ports: ICANN never assigns or control port number from range 1,024 to 49,151. Instead, the port number from this range can be registered with ICANN to prevent duplication.
- Dynamic Port: Port numbers from the range 49,152 to 65,535 are neither assigned by ICANN to any port nor these port numbers can be registered with ICANN. These port numbers are ephemeral port numbers and are chosen for client processes.
3. Encapsulation and Decapsulation
Whenever a client process has some message to forward to the server process it passes the message to the transport layer along with the pair of socket addresses. Here one socket address determines the IP address and port number of the client and another socket address determines the IP address and port number of the server.
Receiving the message and socket addresses the transport layer encapsulates the message and attach the transport layer header to it and pass the message to the network layer where it is encapsulated into an IP packet.
When the message arrives at the transport layer of the server system before passing it to the server process transport layer decapsulates it and drops the transport layer header attached to the message by the client’s transport layer. The transport layer provides the socket address of the client system to the server process in case the server process wants to respond to the client’s message.
4. Multiplexing and Demultiplexing
The transport layer also performs the function of multiplexing and demultiplexing. As at the client site, there may be several processes running at the application layer. Each process may have to send messages to the processes at the same or different server site.
The transport layer at the client site performs multiplexing on the messages from client processes. At the server site, the transport layer performs demultiplexing on the received messages to distribute them to the corresponding server processes.
5. Flow Control
The transport layer also controls the flow of information from source to destination. It prevents the sender host from producing data faster than a receiver can accept. The transport layer at the source site and at the destination site act as both producer and consumer.
The transport layer at the source site consumes the messages produced by the processes at the source application layer and produces the encapsulated packet for the network layer. Similarly, the transport layer at the destination site consumes the messages from source processes, decapsulates them, and produces messages to processes at the application layer of the destination site.
The flow control can be implemented by adding a buffer on both the source and destination transport layer. Once the buffer at the source is full the transport layer will convey the application layer to stop passing the message and resume passing when the buffer has vacancies. Similarly, the buffer at the destination site informs the sending transport layer to stop sending the packet if it gets full and resume when the buffer has some vacancies.
6. Error Control
The transport layer is even responsible to control the error between the sender site transport layer and receiver site transport layer. Transport layer controls error such as:
Identify the corrupted packets and discard those packets.
- The transport layer tracks the discarded and lost packets and sends them again.
- Identify if there are any duplicate packets, if found discard those packets.
- Determine the out-of-order packets by recognizing the gap in the sequence number of the packet and buffer them until all missing packet arrives at destination.
The network layer controls the routing of packets from the source host to the destination host and this transfer is unreliable. However, if the application wants reliability transport layer has to provide the error control service.
7. Congestion Control
Congestion occurs when the load on the network is greater than the capacity of the network. Congestion in the network can occur because of the switches and routers. Switches and router also maintain a buffer which holds the packets before processing and forwarding it next switch or router.
Well, there are two methods to control congestion open-loop congestion control and closed-loop congestion control. The Open-loop congestion control prevents congestion before it occurs and closed-loop congestion control reduces congestion after it occurs.
8. Connectionless and Connection-Oriented Service
Like the network layer, even the transport layer has two kinds of services when it comes to the connection between the source and destination host i.e. connectionless service and connection-oriented service. The connectionless service refers to the independence between the packets of the same message and connection-oriented services refer to the dependency between the packets of the same message.
Issues such as flow and error control, congestion control cannot be effectively implemented in connectionless service while this can be effectively implemented in connection-oriented service.
So this is all about the transport layer service. The transport layer is only interested in process-to-process communication whereas the routing of messages from a process on the sender’s site to process on the receiver’s site is managed by the network layer.