Cisco SDWAN Demo
Cisco SDWAN Demo
Expert-Led Live Training | 27th April 2025 @04 PM IST
Day
Hr
Min
Sec
Join Now
USD ($)
$
United States Dollar
India Rupee

How Does TCP Work in Computer Networking

Created by Himanshu Sharma in Articles 18 Apr 2025
Share
«Mac Address Flooding: Learning & Aging

TCP is a transport layer protocol in the TCP/IP protocol suite, which is used in computer networking. Its purpose is to ensure reliable communication between applications across a network.

It breaks down data chunks into small packets. It also has some rules and procedures for the packets to transmit and receive from one end to another. This protocol suite encompasses several layers, each responsible for different aspects of data handling, including packetization, addressing, routing, and error checking.

Understanding how TCP/IP works is essential for grasping the fundamentals of internet connectivity and data exchange in today's digital landscape. In this article, we will learn about the TCP/IP protocol, its structure, and how it works.

Additionally, enrolling in Cisco enterprise certifications can further enhance your understanding of TCP/IP and networking concepts. Certifications such as Cisco Certified Network Associate (CCNA) and Cisco Certified Network Professional (CCNP) provide valuable knowledge.

What is TCP/IP?

TCP/IP stands for Transmission Control Protocol/Internet Protocol, which is a suite of communication protocols that form the foundation of the Internet and facilitate communication between devices across networks.

TCP/IP breaks down data into smaller packets, addresses them, sends them through the network, and ensures they are reassembled in the correct order at the destination. This process includes error checking and retransmission of lost packets.

TCP/IP was developed in the 1970s by the U.S. Department of Defense for ARPANET, the precursor to the Internet. It was adopted as a standard protocol suite in 1983 and has since become the backbone of modern networking.


CCNP Certification TrainingJoin our online live training class.Explore course
custom banner static image

How Does TCP Work?

TCP handshake diagram

TCP connection and data transfer can be understood in 5 easy steps:

Step 1: Connection Establishment: TCP establishes a connection between the client and server using a three-way handshake (SYN, SYN-ACK, ACK).

Step 2: Data Transfer: Data is broken into smaller chunks called segments and transmitted over the network.

Step 3: Acknowledgment: The receiving end acknowledges the received segments, ensuring reliable delivery.

Step 4: Flow Control: TCP regulates the flow of data to prevent the sender from overwhelming the receiver.

Step 5: Connection Termination: The connection is terminated using a four-way handshake (FIN, ACK, FIN, ACK).


How is a TCP Connection Established

TCP is a connection-oriented protocol, which means a secure connection is established between two hosts before sending and receiving the actual data packets between these two hosts. This is achieved by establishing a three-way handshake connection between the sender and the receiver. The following are the steps:

Step 1. The host who wants to send data (client) first sends a packet with a SYN flag to the receiving host to establish a connection.

Step 2. The receiving host responds (Server) with a packet having a SYN-ACK flag and also acknowledging the request and indicating that it is ready to receive the data.

Step 3. The sending host responds (Client) with an ACK packet, confirming that the connection has been established and data can now be sent.

The data can be sent and received between the two hosts only when connections have been established using TCP packets.

How is TCP Connection Terminated

Similarly, whenever a host wants to terminate its connection with the other host, TCP uses a four-way handshake process to terminate connections.

Step 1. One end sends a FIN packet to signal the end of the connection.

Step 2. The other end responds with an ACK packet to confirm receipt of the FIN packet.

Step 3. The other end sends its own FIN packet.

Step 4. The original sender responds with an ACK packet to confirm receipt.

This completes the four-way handshake process, and the connection is closed.

TCP Header Structure

At the packet level, a TCP packet consists of many different fields, and each field has its own functions. The TCP header diagram is shown below:

TCP header diagram
● Source port: This is a 16-bit field that specifies the port number of the sending application. If the application is HTTP and it is sending data then its port number is 80.

● Destination port: This is also a 16-bit field, but it specifies the port number of the receiving application. If the receiving application is SSH then its port number is 22.

● Sequence number: This is a 32-bit field that identifies the number of bytes in the data. The data packet follows some order while sending and receiving so the sequence number is used to keep track of the order of packets. The initial data packet has a unique sequence number called ISN (Initial Sequence Number).

The sending host used this number to send data while the receiving host reassembled it and brought the packets in the correct order.

● Acknowledgment number: This is also a 32-bit field, but it is only used by the receiver. It contains the sequence number of the next expected packet, and it is used to acknowledge receipt of packets that have been successfully received.

● Header length: This is a 4-bit field that specifies the TCP header length. The TCP header contains several different fields, and its length can vary depending on which fields are included.

● Reserved: This is a 6-bit field that is reserved for future use and is currently set to zero.

● Control bits: This is a 6-bit field that contains several control flags that control packet processing. Flags like SYN, ACK, FIN, RST, PSH, and URG are used to establish and terminate connections and control how data is processed.

● Window size: This is a 16-bit field and specifies the amount of data the receiving host can accept.

● Checksum: This is a 16-bit field used to verify packet integrity. Checksum uses various factors such as IP addresses and packet contents etc. to calculate its values.

● Urgent pointer: This is a 16-bit field that is used in conjunction with the URG flag to indicate that certain data within the packet is urgent and should be processed immediately.

● Options: This is an optional field that is mostly used to carry information like MSS, i.e., Maximum Segment Size. It is the maximum-sized segment that the sender wants to receive.

When a TCP packet is sent from one host to another. It is first encapsulated with an IP header which has the source and destination IP addresses. Using this a packet can be routed across the networks. In the transmitted network a packet can be delayed.

Read our detailed article on TCP Header

How Does TCP Ensure a Reliable Connection? 

The TCP provides reliable communication by using a variety of techniques to detect and correct errors that may occur during transmission.

● Acknowledgments: When a sender sends data packets, it expects an acknowledgment from the receiver. If the sender gets the acknowledgment within a specific time, it means the packet was delivered successfully. If not, the packet is considered lost, and the sender will resend it.

Flow Control: This feature prevents the sender from overwhelming the receiver with too much data. The receiver uses a "window size" to indicate how much data it can handle at a time. If the sender sends data too quickly, the receiver reduces its window size, forcing the sender to slow down.

Congestion Control: This mechanism prevents network congestion and ensures efficient data transmission. One method, called "slow start," gradually increases the amount of data sent until the network reaches a stable state. Once stable, data can be transmitted more quickly.

Summing Up!!

TCP is a complex protocol that is essential for reliable communication between applications across a network. By breaking down data into small packets, providing error detection and correction mechanisms, and using techniques like flow control and congestion control, TCP ensures that data is transmitted efficiently and reliably.

By breaking down data into manageable packets and ensuring their accurate delivery, TCP/IP supports a wide range of applications, from web browsing to email transmission. Its layered architecture allows for flexibility and scalability, making it adaptable to various networking environments.

As technology continues to evolve, the importance of understanding how TCP/IP operates remains paramount for anyone involved in networking, cybersecurity, or IT infrastructure development

TCP vs UDP Differences Explained with ...»
Himanshu Sharma

Himanshu Sharma is a highly professional Network data engineer and IT trainer. He is working in IT industry since more than 10 years. He has worked with top global companies like IBM, Wipro, TCS, HCL, etc. His experience in these top companies makes him one of the most successful network engineer in industry. Himanshu has done wide range of ...

More... | Author`s Bog | Book a Meeting

Related Articles

#Explore latest news and articles

What is BGP and How Does it Work? 20 Dec 2024

What is BGP and How Does it Work?

Discover what is BGP and how it works. The concepts lay the foundation for a deeper understanding of internet routing.
What are Network Port Numbers? - Easy Explanation 19 Mar 2025

What are Network Port Numbers? - Easy Explanation

List of Network Port Numbers including TCP Protocol Port Numbers in networking, understand their significance in networking & many more. Start Reading!
Static Routing Configuration on Cisco Routers 4 Nov 2024

Static Routing Configuration on Cisco Routers

Learn to configure static routes on Cisco routers in a lab scenario with a focus on IPv4 and IPv6 static and default routing concepts.

FAQ

TCP ports are 16-bit numbers that identify specific processes or services running on a device. They enable multiple applications to communicate over the same IP address by directing data packets to the correct endpoint.
A TCP session is established through a three-way handshake: the client sends a SYN packet, the server responds with a SYN-ACK, and the client sends an ACK, creating a reliable connection for data transmission.
The three steps of TCP are: 1) Connection Establishment (three-way handshake) 2) Data Transfer (sending and receiving segments) 3) Connection Termination (four-way handshake to close the session).
The TCP layer operates at the transport layer of the TCP/IP model, managing reliable data transmission between applications by segmenting data, ensuring error-free delivery, controlling flow, and establishing or terminating connections.

Comments (0)

Himanshu Sharma

Himanshu Sharma

Ex Network Engineer & Instructor @UniNets Instructor role
★★★★★ 4.98
Faithful User
Expert Vendor
Golden Classes
King Seller
Fantastic Support
+91 8383 96 16 46

Enquire Now

Captcha
Share to your friends

Share

Share this post with others

Contact learning advisor

Captcha image