Following are some of the services offered by the Transmission Control Protocol (TCP) to the processes at the application layer:
All the above mentioned TCP services are explained below in detail.
TCP is a stream-oriented protocol. It enables the sending process to deliver data as a stream of bytes and the receiving process to acquire data as a stream of bytes.
TCP creates a working environment so that the sending and receiving procedures are connected by an imaginary "tube", as shown in the figure below:
The sending and receiving processes cannot produce and receive data at the same speed. Hence, TCP needs a buffer for storage.
There are two methods of buffers used in each dissection, which are as follows:
A buffer can be implemented by using a circular array of 1-byte location, as shown in the figure below. The figure shows the movement of data in one direction on the sending side.
The buffer has three types of locations, which are as follows:
In practice, the TCP may send only a port of data due to the slowness of the receiving process or congestion in the network.
The buffer at the receiver is divided into two parts as mentioned below:
Buffering is used to handle the difference between the speed of data transmission and data consumption. But only buffering is not enough.
We need one more step before sending the data on the Internet Protocol (IP) layer as a TCP service provider. It needs to send data in the form of packets and not as a stream of bytes.
At the transport layer, TCP groups several bytes into a packet and this is called a segment. A header is added to each segment to exercise control.
The segment is encapsulated in an IP diagram and then transmitted. The entire operation is transparent to the receiving process. The segment may be deceived out of order, lost or corrupted when it receives the receiving end.
The figure given below shows how the segments are created from the bytes in the buffers:
The segments are not of the same size. Each segment can carry hundreds of bytes.
TCP offers a full-duplex service where the data can flow in both directions simultaneously. Each TCP will then have a sending buffer and receiving buffer. The TCP segments are sent in both directions.
We are already aware that the TCP is a connection-oriented protocol. When a process wants to communicate (send and receive) with another process (process -2), the sequence of operations is as follows:
The type of connection in TCP is not physical, but it is virtual. The TCP segment encapsulated in an IP datagram can be sent out of order. These segments can get lost or corrupted and may have to be resend. Each segment may take a different path to reach the destination.
TCP is a reliable transport protocol. It uses an acknowledgment mechanism for checking the safe and sound arrival of data.