Understanding the two main ways data travels across the internet

By The Coding Gopher

Published: 2026-09-07

URL: https://thecodinggopher.substack.com/p/tcp-vs-udp-explained


Deconstructing network protocols, packet loss, and why unreliability is sometimes an engineering requirement.TCP and UDP essentials | NetworkAcademy.IOTCP (Transmission Control Protocol) and UDP (User Datagram Protocol) are the two primary ways data is sent across the internet. The core difference is that TCP prioritizes reliability (ensuring all data arrives perfectly), while UDP prioritizes speed (getting data there as fast as possible).

When an application sends data over the internet, the physical network (routers, fiber optics, cell towers) offers no guarantees. Cables get cut, overwhelmed routers drop packets when their memory buffers fill up, and data often takes different physical paths and arrives completely out of order. At the lower Network Layer (IP), the internet is essentially just a best-effort delivery service.

Note: Routers, fiber optics, and cell towers are the core technologies that build modern communication networks. Routers are the traffic directors that guide your digital information, fiber optics act as the super-fast underground highways that move data, and cell towers provide the wireless signals that let your devices connect from anywhere.

To solve this, engineers must wrap their raw application data in a Transport Layer protocol before sending it over the network. The two foundational transport protocols of the internet are TCP (Transmission Control Protocol) and UDP (User Datagram Protocol). They represent entirely opposite engineering philosophies.

Subscribe now

1. TCP: The Reliable Pipe

TCP is a stateful, connection-oriented protocol. It is designed to be the “certified mail” of the internet.

The Handshake: Before a single byte of application data is sent, the client and server must execute a strict 3-way handshake (SYN, SYN-ACK, ACK). This establishes a dedicated connection, synchronizes initial sequence numbers, and negotiates parameters like window sizes so a fast sender doesn’t overwhelm a slow receiver.protocol theory - Sequence numbers of segments in three way handshakes of  TCP connection establishment or termination - Network Engineering Stack  ExchangeThe TCP 3-Way Handshake is a foundational process used in computer networking to establish a reliable, connection-oriented session between a client and a server before any actual data is transferred. It ensures that both sides are synchronized and ready to communicate securely.

The Guarantee: TCP guarantees perfect, in-order delivery. Because every packet is sequentially numbered, if the receiver gets packet 1, 2, and 4, it mathematically knows packet 3 was lost in transit.CS558a Syllabus & ProgressTCP provides guaranteed in-order delivery, while the underlying IP (Internet Protocol) operates out of order to deliver packets as fast as possible. In the TCP/IP networking model, IP simply routes individual packets through the fastest available paths. Since packets take different paths, they frequently arrive out of order. TCP fixes this by reordering packets and hiding this complexity from your applications.

The Mechanism: When TCP detects a missing packet, it triggers a mechanism called Head-of-Line Blocking. The receiver actively halts the entire data stream. It refuses to process packet 4, and sends a message back to the sender demanding it retransmit packet 3.In-depth interpretation of the past and present of HTTP - 个人文章 -  SegmentFault 思否TCP Head-of-Line (HoL) blocking is a networking bottleneck where a single lost or delayed data packet at the front of a TCP queue stalls the entire connection. Because TCP guarantees strict, in-order packet delivery, the receiver cannot process subsequent packets until the missing packet is retransmitted and received.

The Use Case: TCP is mandatory when data integrity is absolute. You cannot download an executable file, load a webpage, or execute a database transaction with missing bytes. If a single packet is missing, the file is corrupted.TCP Speeds DiagramTCP (Transmission Control Protocol) is used whenever data accuracy and reliable delivery are top priorities. It ensures that no data packets are lost, duplicated, or delivered out of order.

2. UDP: The Stateless FirehoseTCP vs. UDP vs. gRPC: Choosing the Right Protocol for Your ArchitectureUDP (User Datagram Protocol) is a lightweight, connectionless network protocol that prioritizes speed over reliability. It sends data packets directly to a destination without establishing a formal connection or checking if they arrived, making it ideal for real-time applications where minor data loss is preferred over delays.

UDP is a connectionless protocol. There is no handshake, no sequence tracking, no flow control, and absolutely no acknowledgment from the receiver. The sender simply addresses the datagrams and blasts them into the network as fast as the physical hardware allows.TCP vs. UDP — What's the Difference and Which Protocol is Faster?

No Guarantees: If a router drops packet 3 due to congestion, UDP does not care. The receiver gets packet 1, 2, and 4, and hands them directly to the application. The sender never knows packet 3 was dropped, and the receiver never asks for it back.