Compare

TCP vs UDP

TCPEvery packet, in order

WhatsApp voice call

DK

Ringing…

DKcalling
Rajat hears…
UDPThe newest packet, now

WhatsApp voice call

DK

Ringing…

DKcalling
Rajat hears…

DK calls Rajat on WhatsApp: their voices travel as small packets, fifty a second. Rajat picks up, walks into a lift, and DK sends a message mid-call. Illustrative times.

TCP or UDP?

UDP when the newest packet matters more than a lost one: calls, games, live video. TCP when everything must arrive, in order: messages, payments, web pages. Most apps use both.

DifferenceTCPUDP
Before the first byteA handshake: SYN, SYN-ACK, ACKNothing: send at once
A lost packetSent again; everything behind it waitsGone; the next one plays
OrderAlways in orderAs they arrive
On a callFreezes, then plays lateA 20 ms blip, stays live
A busy networkSlows itself down, fairlyKeeps sending; the app decides
Used forMessages, web pages, payments, filesCalls, games, live video, DNS

TCP vs UDP, explained step by step

1. Rajat picks up

DK calls Rajat on WhatsApp. Their voices travel as small packets, fifty every second. On the left, they go over TCP: every packet arrives, in order, or the connection waits until it does. On the right, over UDP: packets just fly, and a lost one stays lost. Let’s put both through three situations.

First, Rajat picks up. TCP shakes hands before anything flows: a SYN, a SYN-ACK and an ACK, one full round trip across the network. Only then can DK’s first word set off.

UDP doesn’t shake hands. DK’s first word leaves the moment Rajat picks up, a round trip sooner.

2. A lost packet

Next, Rajat steps into a lift, and packet forty-three is lost. TCP holds every packet behind it until forty-three is sent again, so the call freezes, then plays a burst of late audio, and the delay sticks.

With UDP, packet forty-three is simply skipped. The app fills the gap, twenty milliseconds of sound, and the call stays live.

3. A message

Finally, DK types: running five minutes late. A message must arrive whole, and TCP makes sure of it: the lost piece is sent again, and Rajat reads every word, in order.

Over plain UDP, the same message loses a piece and arrives with a hole in it. That’s why WhatsApp sends messages over TCP, and keeps UDP for the call itself.

In short

So which should you pick? UDP when the newest packet matters more than a lost one: calls, games, live video. TCP when everything must arrive, in order: messages, payments, web pages. Most apps use both.