INTERNET FUNDAMENTALSAI-REVIEWED

What is TCP?

Useful first: IP addresses · optional, not a requirement

Choose your depth

Stay with the essentials, or look closer.

Simple explanation
2 min read · estimate

YOUR GOALUnderstand what TCP adds to IP delivery and why reliability is different from privacy.

Keep the received data in the right order.

Addressing and ordering solve different problems

IP carries packets between network addresses. TCP adds a connection that applications use to exchange data in order, even when packets arrive out of order. It also handles retransmission when data is lost.

Imagine downloading a cooking guide. The application needs the file's bytes in their original order, not whichever order pieces happened to reach your computer. TCP handles that ordering below the application.

[1] [2]

Reliable does not mean secret or unbreakable

TCP alone does not encrypt the guide or authenticate the website. TLS can add cryptographic protection to an application's connection. A TCP handshake is not a certificate check.

Reliability also cannot repair a permanently disconnected cable or a failed server. A transfer may stall or fail; TCP does not promise that it will finish by a particular time.

[2] [5]
THE IDEA TO KEEP

TCP supplies ordered transport; encryption and successful completion are separate concerns.

ONE THING TO WATCH OUT FOR

TCP makes the contents of every connection private.

TCP alone provides no encryption. A protocol such as TLS is needed for cryptographic protection.

A QUICK CHECK, NOT A TEST
A guide is transferred using plain TCP with no added security protocol. Which statement is correct?
Show the explanation

TCP handles byte ordering, but does not itself encrypt the guide. Transport ordering is TCP's job. Encryption and certificate-based authentication require a security protocol such as TLS.

Progress is saved only in this browser.

KEEP EXPLORINGIP addresses
Was this explanation clear?
Report a mistake by email
Basic explanation
2 min read · estimate

YOUR GOALRecognize the handshake and explain why an application must frame messages inside the byte stream.

Follow the connection and define your messages.

A common connection start

In the usual three-way handshake, a client sends SYN, the server replies with SYN-ACK, and the client sends ACK. This synchronizes the connection's starting sequence numbers in both directions.

Once established, both sides can send data. Sequence numbers track byte positions; they are not labels for application messages.

[2]

Two writes need not produce two reads

Suppose an application sends RED and then BLUE. The peer might read RE first and DBLUE later, or receive REDBLUE together. The bytes keep their order, but read boundaries need not match write boundaries.

The application therefore needs framing: for example, a defined length prefix or a delimiter. With newline-delimited text, it can buffer incomplete input and extract complete lines, provided its rules also handle newlines inside a message.

[3]
THE IDEA TO KEEP

TCP connects two peers and carries bytes; the application protocol defines where its messages end.

ONE THING TO WATCH OUT FOR

Each send call becomes exactly one receive call at the other end.

The stream may be read in different-sized chunks, so the receiver must assemble messages using its protocol's rules.

A QUICK CHECK, NOT A TEST
A sender writes RED and then BLUE. A receiver reads RE and then DBLUE. What does this indicate?
Show the explanation

Normal stream behavior; the receiver must use framing to recover messages. The combined byte sequence is still REDBLUE. TCP preserves order, not the sender's write-call boundaries.

Progress is saved only in this browser.

KEEP EXPLORINGIP addresses
Was this explanation clear?
Report a mistake by email
Advanced explanation
3 min read · estimate

YOUR GOALDistinguish receiver capacity, network congestion, loss recovery, and confirmation of an application operation.

Separate transport limits from application success.

Two windows constrain outstanding data

The receiver advertises a receive window, or rwnd, to limit how much data it is prepared to accept. This is flow control. The sender also maintains a congestion window, or cwnd, to limit outstanding data according to network conditions.

In a simplified example, suppose rwnd is 64,000 bytes and cwnd is 12,000 bytes. The smaller window constrains transmission: 12,000 bytes, not 64,000. If 8,000 bytes are already outstanding, the remaining allowance is at most 4,000 bytes under those unchanged limits. Windows are byte allowances, not fixed transfer speeds.

[4]

Recovery can delay useful data

When retransmission is driven by a timeout, TCP resends unacknowledged data. Before timing samples are available, TCP uses an initial timeout. Once samples are available, it adapts the timeout to round-trip timing and variation; repeated timer expirations back off the waiting interval. Recovery is not a promise of immediate delivery.

A gap in TCP's ordered stream can also hold up later bytes that have already arrived. This matters when several exchanges share the connection. HTTP/3 uses QUIC over UDP rather than TCP and avoids this particular cross-stream transport dependency; that does not make every HTTP/3 request faster.

[6] [7] [8]

An ACK is not a saved-file receipt

A TCP acknowledgment means the peer's TCP implementation has accepted responsibility for the acknowledged bytes. It does not prove that an application wrote them to durable storage.

For a file upload, define an application-level success response that means the file was saved. Treat a TCP ACK and that response as different evidence.

[2]
THE IDEA TO KEEP

Flow control protects receiver capacity, congestion control responds to the network, and application success needs application evidence.

ONE THING TO WATCH OUT FOR

A large receive window means the sender can always transmit that much immediately.

The congestion window and bytes already outstanding also constrain transmission.

A QUICK CHECK, NOT A TEST
rwnd is 64,000 bytes, cwnd is 12,000 bytes, and 8,000 bytes are outstanding. Ignoring other limits, how much more fits within both unchanged windows?
Show the explanation

At most 4,000 bytes. The smaller window is 12,000 bytes. Subtract the 8,000 bytes already outstanding to get a remaining allowance of 4,000 bytes.

Progress is saved only in this browser.

KEEP EXPLORINGIP addresses
Was this explanation clear?
Report a mistake by email
GO STRAIGHT TO THE SOURCE

Keep asking. Check the details.

Source-checked using AI (OpenAI Codex) on . The checks covered sources, examples, and quizzes for this article version.

No human review is claimed. AI review can miss errors; check the original sources below.

  1. Cloudflare Learning Center — What are IP and TCP?
  2. RFC 9293 — TCP concepts, connection establishment, and acknowledgments
  3. Python documentation — Using stream sockets and framing messages
  4. RFC 5681 — TCP congestion control and receive/congestion windows
  5. RFC 8446 — The Transport Layer Security protocol
  6. RFC 6298 — Computing TCP's retransmission timer
  7. RFC 9114 — HTTP/3 and the limits of TCP multiplexing
  8. RFC 9000 — QUIC uses UDP datagrams and integrates TLS
How explanations are prepared