Skip to content
EN
Get Started

TCP (Transmission Control Protocol)

TCP (Transmission Control Protocol) is a transport protocol that provides a reliable, ordered byte stream between applications over an IP network.

Table of Contents (8 sections)

How TCP works

TCP sits between application protocols and IP. IP routes packets between addresses, while TCP gives applications an ordered byte stream. Each connection is identified by its source and destination IP addresses plus its source and destination ports.

Before sending application data, the endpoints complete a three-way handshake:

  1. The client sends SYN.
  2. The server replies with SYN-ACK.
  3. The client returns ACK.

TCP then splits bytes into segments. Sequence numbers put received bytes back in order, checksums detect damage and acknowledgments confirm arrival. Missing data is retransmitted. Flow control protects the receiver, while congestion control reduces the sending rate when the network is overloaded.

TCP handles ordinary packet loss, but it doesn’t promise that every connection will finish. A broken route, unavailable server or timeout can still stop it.

A small TCP example

A browser might open an ephemeral client port to a server’s HTTPS port:

192.0.2.10:53124  →  TCP  →  203.0.113.20:443

After the handshake, SSL/TLS negotiates encryption and the browser sends HTTP data. Replies can cross the network in different segment sizes, but TCP exposes the bytes to the browser in the correct order. A connection closes with a FIN exchange or immediately with an RST reset.

TCP vs UDP

TCP and UDP both transport application data, but they provide different services.

TCP UDP
Connection setup Three-way handshake None
Delivery Ordered stream with retransmission Independent datagrams, no recovery
Overhead Higher Lower
Common uses HTTPS, SSH and email DNS, live media and QUIC

The application chooses the protocol. HTTP/1.1 and HTTP/2 normally use TCP, while HTTP/3 uses QUIC over UDP and implements reliability itself.

How TCP relates to proxies

Using a proxy server normally involves two TCP legs: one from your client to the proxy and another from the proxy to the website. The website sees the proxy’s exit IP as the source of the second leg.

For HTTPS through an HTTP proxy, your client sends CONNECT example.com:443 after reaching the proxy. The proxy opens the target connection and, if successful, relays the encrypted TLS data through the tunnel. TCP manages each leg independently.

Failures can occur on either side. A connection timeout while reaching the proxy can indicate a wrong host, port or firewall rule. A timeout after the tunnel is created may come from the proxy’s outbound connection or the target website.

FAQ

Is TCP the same as HTTP?

No. TCP transports bytes, while HTTP defines requests and responses. HTTP commonly runs over TCP, but HTTP/3 runs over QUIC and UDP.

Does TCP encrypt data?

No. TCP provides ordering, error detection and retransmission, not confidentiality. HTTPS adds TLS encryption above TCP.

Does TCP guarantee delivery?

Only while the connection remains usable. TCP retransmits missing data and preserves order, but it reports an error if the network or endpoint fails before delivery completes.

Related Terms

View All Terms