Conceptly
← All Concepts
πŸ“¦

TCP/IP

ProtocolA reliable, connection-oriented transport protocol

TCP (Transmission Control Protocol) and IP (Internet Protocol) form the core protocol stack of the internet. TCP establishes connections via a 3-way handshake and detects data loss and out-of-order delivery for retransmission. IP routes each packet to its destination.

β–ΆArchitecture Diagram

πŸ”„ Process

Dashed line animations indicate the flow direction of data or requests

Why do you need it?

Data on the internet does not move as one clean, guaranteed stream. Packets can take different routes, arrive out of order, get duplicated, or disappear entirely. Yet users do not accept half-loaded pages, corrupted files, or database conversations where pieces are silently missing. If every application had to reinvent reliability from scratch, systems would duplicate the same error-handling logic over and over and still get it wrong in inconsistent ways. TCP exists to solve that reliability problem once at the transport layer, so application developers do not have to rebuild it for every protocol.

Why did this approach emerge?

Packet-switched networks made communication more flexible, but they also made delivery less predictable. Early systems had to deal with loss and error recovery in ad hoc ways, which meant every application effectively carried part of the burden of being its own transport protocol. That duplication was inefficient and harmful to interoperability. TCP/IP became important because it turned the internet from a loose collection of connected networks into a shared end-to-end communication platform with a common reliability model. Once that model existed, application protocols could assume a stable transport foundation instead of rebuilding it themselves. The reason so much modern software quietly depends on TCP is that the internet became usable at scale only after this shared reliability layer existed.

How does it work inside?

TCP begins by establishing a connection through the three-step SYN, SYN-ACK, ACK handshake, making sure both sides are ready to talk. Once the connection is up, it breaks data into segments and labels them with sequence numbers so the receiver can tell what is missing and what arrived out of order. The receiver sends acknowledgments to report how much was received successfully, and the sender retransmits data when those acknowledgments do not arrive in time. TCP also manages flow control so a fast sender does not overwhelm a slow receiver, and congestion control so the connection reacts to stressed network conditions instead of blindly flooding the path. In other words, TCP is not just 'send bytes'; it is a disciplined conversation in which progress only counts when the other side confirms what it got.

What is it often confused with?

TCP and UDP both sit above IP and carry application data across the network. The difference is what they optimize for. TCP prioritizes correctness by adding connection setup, ordering guarantees, retransmission, and backpressure. UDP strips much of that away so data can be sent with less coordination and less delay, but it leaves loss, ordering, and recovery to the application or to chance. That makes TCP the natural fit when data cannot be wrong or incomplete, and a poorer fit when latency matters more than perfection. The right choice is rarely 'which one is better' in general; it is 'can this application tolerate loss and reordering, or not?'

When should you use it?

TCP is the default fit for web traffic, file transfer, email, database sessions, and most business-critical communication where missing or reordered data is unacceptable. It is especially useful when two systems need to maintain a coherent conversation over time rather than fire off isolated datagrams. Its downside is that reliability work costs time and coordination, so the protocol can feel heavy in latency-sensitive scenarios. That is why the decision to use TCP should start with a reliability question, not a speed question: is it acceptable for this communication to lose or scramble data? When the answer is no, TCP is usually the right baseline because it lets applications focus on meaning instead of rebuilding transport correctness.

Web communication -- reliable delivery of HTTP/HTTPS requests and responsesFile transfer -- lossless data delivery via FTP and SFTPEmail -- sending and receiving mail via SMTP and IMAPDatabase connections -- exchanging queries and results between clients and DB servers