TCP (Transmission Control Protocol) is one of the main protocols of the Internet protocol suite. It lies between the Application and Network Layers which are used in providing reliable delivery services. It is a connection-oriented protocol for communications that helps in the exchange of messages between the different devices over a network.

Working of TCP
To make sure that each message reaches its target location intact, the TCP/IP model breaks down the data into small bundles and afterward reassembles the bundles into the original message on the opposite end. Sending the information in little bundles of information makes it simpler to maintain efficiency as opposed to sending everything in one go.
After a particular message is broken down into bundles, these bundles may travel along multiple routes if one route is jammed but the destination remains the same.
For example, When a user requests a web page on the internet, somewhere in the world, the server processes that request and sends back an HTML Page to that user. The server makes use of a protocol called the HTTP Protocol. The HTTP then requests the TCP layer to set the required connection and send the HTML file.
Now, the TCP breaks the data into small packets and forwards it towards the Internet Protocol (IP) layer. The packets are then sent to the destination through different routes.
The TCP layer in the user’s system waits for the transmission to get finished and acknowledges once all packets have been received.
Features of TCP/IP
Some of the most prominent features of Transmission control protocol are
1. Segment Numbering System
- TCP keeps track of the segments being transmitted or being received by assigning numbers to each and every single one of them.
- A specific Byte Number is assigned to data bytes that are to be transferred while segments are assigned sequence numbers.
- Acknowledgment Numbers are assigned to received segments.
2. Flow Control
- Flow control limits the rate at which a sender transfers data. This is done to ensure reliable delivery.
- The receiver continually hints the sender on how much data can be received (using a sliding window)
3. Error Control
- TCP implements an error control mechanism for reliable data transfer
- Error control is byte-oriented
- Segments are checked for error detection
- Error Control includes – Corrupted Segment & Lost Segment Management, Out-of-order segments, Duplicate segments, etc.
4. Congestion Control
- TCP takes into account the level of congestion in the network
- Congestion level is determined by the amount of data sent by a sender
Advantages
- It is a reliable protocol
- It provides an error-checking mechanism as well as one for recovery
- It gives flow control
- It makes sure that the data reaches the proper destination in the exact order that it was sent
- Open Protocol, not owned by any organization or individual
- It assigns an IP address to each computer on the network and a domain name to each site thus making each device site to be distinguishable over the network.
Disadvantages
- TCP is made for Wide Area Networks, thus its size can become an issue for small networks with low resources
- TCP runs several layers so it can slow down the speed of the network
- It is not generic in nature. Meaning, it cannot represent any protocol stack other than the TCP/IP suite. E.g., it cannot work with a Bluetooth connection.
- No modifications since their development around 30 years ago.
TCP services
Following are some of the services offered by the Transmission Control Protocol (TCP) to the processes at the application layer:
- Stream Delivery Service.
- Sending and Receiving Buffers.
- Bytes and Segments.
- Full Duplex Service
- Connection Oriented Service.
- Reliable Service.
All the above mentioned TCP services are explained below in detail.
Stream Delivery Service
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:

Sending and Receiving Buffers
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:
- Sending Buffer
- Receiving Buffer
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:
- Empty Locations.
- Locations that contain the bytes which have been sent, but not acknowledged. These bytes are kept in the buffer till an acknowledgment is received.
- The location that contains the bytes which are to be sent by the sending TCP

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:
- The part was containing empty locations.
- The part was containing the received bytes, which the sending process can consume.
Bytes and Segments
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.
Full-Duplex Service
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.
Connection-Oriented Service
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:
- TCP of process-1 informs TCP of process-2 and gets its approval.
- TCP of process-1 tells TCP of process-2 exchange data in both directions.
- After completing the data exchange, when buffers on both sides are empty, the two TCPs destroy their buffers
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.
Reliable Service
TCP is a reliable transport protocol. It uses an acknowledgment mechanism for checking the safe and sound arrival of data.
TCP features
Features
- TCP is reliable protocol. That is, the receiver always sends either positive or negative acknowledgement about the data packet to the sender, so that the sender always has bright clue about whether the data packet is reached the destination or it needs to resend it.
- TCP ensures that the data reaches intended destination in the same order it was sent.
- TCP is connection oriented. TCP requires that connection between two remote points be established before sending actual data.
- TCP provides error-checking and recovery mechanism.
- TCP provides end-to-end communication.
- TCP provides flow control and quality of service.
- TCP operates in Client/Server point-to-point mode.
- TCP provides full duplex server, i.e. it can perform roles of both receiver and sender.