TCP Features and Functions Explained with Examples
Three-way handshake, connection-oriented operation, sequencing, acknowledgment, error recovery, flow control, and windowing are TCP features. TCP uses these features to provide guaranteed data delivery and ensure that each bit sent from the source host reaches the destination host. This tutorial explains these features and describes how TCP differs from UDP.
Connection-oriented and connectionless protocols
TCP is a connection-oriented protocol. The difference between a connection-oriented protocol and a connectionless protocol is that a connection-oriented protocol does not send any data until a proper connection is established. Connection establishment refers to the process of initializing protocol-specific features. During connection establishment, TCP initializes the sequence and acknowledgment numbers. TCP refers to this process as the three-way handshake process.
TCP Three-way handshake process
Source sends a SYN (synchronization) segment to the destination. This segment indicates that the source wants to establish a reliable session with the destination. A segment is a data packet that protocols running at the Transport layer use to exchange data and protocol-specific information between source and destination devices.
Destination responds with a SYN/ACK (synchronization/acknowledgement) segment. This segment indicates that the destination has received the source's connection request and is ready to establish a reliable session with the source.
Upon receiving a SYN/ACK segment from the destination, the source sends an ACK (acknowledgement) segment to the destination. This segment indicates that the source received the confirmation from the destination, and the session is now fully reliable.
After completing the three-way handshake process, the source and destination devices can exchange data.

TCP does not send data unless a proper connection is established. Segments used in the connection establishment (three-way handshake) process contain only the header information needed to initialize TCP-specific features. These features are explained below.
Reliability through acknowledgement and sequencing
The term TCP reliability contains the following.
- Recognizing and resending lost packets
- Detecting and dropping duplicate packets
- Recognizing and reordering the packets that arrive out of order
- Controlling the overflow of segments
To provide reliability, TCP assigns a sequence number to each sent segment. This number helps the destination device reorder any incoming segments that arrived out of order and verifies that all sent segments were received.
Acknowledgement numbers are used in the opposite direction. These numbers are used to send verification of received segments, notifications of lost segments, and acknowledgements for the next segments. Upon receiving all sent segments, the destination device sends the next segment with an acknowledgment field containing a number one higher than the received sequence number. If any segment is lost in transmission, its sequence number is used in the acknowledgment field to notify the sender.
Both the sequence number and the acknowledgment number are initialized during the three-way handshake. In this process, the source and destination devices exchange their sequence numbers. After knowing each other's sequence numbers, they use them during data exchange.
Flow control through Windowing
Windowing is the process of controlling the flow of segments. It ensures that one host doesn't flood another host with too many segments, overflowing its receiving buffer. In the three-way handshake, the receiver computer, while responding to the initial segment, informs the sender of its window size. Window size is the number of segments that it can store in its buffer. Once the sender computer knows the receiver's window size, it can control the flow of segments.

For example, if the receiver's window size is 4, the sender sends only the 4 segments. Once 4 segments are sent, it waits for confirmation from the receiver computer before sending the next 4 segments. While sending confirmation, the receiver computer can change the window size. For example, it can ask the sender computer to send more or fewer segments in the next transfer. This feature is called sliding windowing or dynamic windowing. It allows the receiver to control the flow of segments that the sender computer can send.

Reordering segments and dropping extra segments in the correct order
To arrange the arrived segments in the correct order, the receiver computer uses the segment sequence numbers. To detect and drop the duplicate or extra segments, it compares the received segments with the requested segments. For example, if the receiver computer requested 3 segments by specifying a window size of 3 in its acknowledgment and received 4 segments, it assumes that one segment arrived in excess.
Sequence numbers also help in detecting duplicate segments. If two or more segments have the same sequence numbers, they are duplicates. Duplicate segments are dropped.

Recovering lost segments
The receiver computer compares the arrived segments with the expected segments. If it finds that any segment is missing, it uses the segment's sequence number to notify the receiver computer. When the sender computer receives an acknowledgment of a segment it has already sent, it assumes the acknowledged segment has been lost. While transmitting the next set of segments (equal to the window size), it retransmits the lost segments first, then new segments. For example, if the window size is 3 and the lost segment is 1, then the transmitted segments will be: lost segment, new segment, and new segment.

Comparing with UDP
UDP is a connectionless protocol. It does not establish a connection or exchange any messages before sending the data.
The TCP protocol always starts a session with the three-way handshake process. It means that if an application wants to send data over TCP, it must wait until the connection is established via the three-way handshake.
UDP doesn't use any mechanism or process before starting the session. It means that if an application wants to send its data over UDP, it can start immediately without delay.
UDP neither sequences the segments nor cares about the order in which they are sent to the destination. It also does not take acknowledgement of the sent segments to verify that they reached the destination. It just sends and forgets about them. Because of this, it is also considered an unreliable protocol.
UDP uses less bandwidth and requires fewer processing cycles than TCP.
This tutorial is part of the tutorial series "Networking reference models explained in detail with examples". Other parts of this series are the following.
Chapter 1 What is a Networking Model Explained
Chapter 2 OSI Model Advantages and Basic Purpose Explained
Chapter 3 Difference between original and modern TCP/IP models
Chapter 4 Similarities and Differences between the OSI and TCP/IP models
Chapter 5 Adjacent-layer and same-layer interactions
Chapter 6 Data Encapsulation and De-encapsulation Explained
Chapter 7 OSI Seven Layers Model Explained with Examples
Chapter 8 TCP/IP Reference Model Explained
Chapter 9 Application layer in the OSI and TCP IP layers models
Chapter 10 Presentation layer and Session layer of the OSI model
Chapter 11 The Transport Layer Explained
Chapter 12 Segmentation Explained with TCP and UDP Headers
Chapter 13 Connection Multiplexing Explained with Examples
Chapter 14 TCP Features and Functions Explained with Examples
Chapter 15 The Network Layer Explained
Chapter 16 The Data Link and Physical layers Explained
Conclusion
TCP is a robust, connection-oriented protocol that ensures reliable data transmission through features such as the three-way handshake, sequencing, acknowledgments, error recovery, and flow control. Its comprehensive mechanisms guarantee data integrity and proper delivery, making it suitable for applications where reliability is crucial. In contrast, UDP is a simpler, connectionless protocol that favors speed and low overhead, making it ideal for scenarios where rapid transmission is more important than reliability.
By ComputerNetworkingNotes Updated on 2026-02-25