🦆 IP Ducky

Networking Fundamentals

TCP vs. UDP: What's the Difference?

TCP and UDP are two ways of delivering data across the internet. Choosing between them is a trade-off between reliability and speed.

TCP: reliable delivery

The Transmission Control Protocol guarantees that data arrives complete and in order. It establishes a connection with a handshake, numbers every chunk of data, waits for acknowledgments, and retransmits anything that gets lost. If packets arrive out of order, TCP reassembles them correctly before handing them to the application.

This reliability has a cost: overhead and latency. Waiting for acknowledgments and retransmissions takes time. But for anything where correctness matters, that cost is worth it.

UDP: fast and lightweight

The User Datagram Protocol just sends packets and hopes for the best. There is no handshake, no ordering, and no retransmission. If a packet is lost, it is simply gone. In exchange, UDP has almost no overhead and no waiting — it is fast and simple.

When each is used

Think of a video call: if a fraction of a second of audio is lost, you would rather skip it and stay live than pause to re-request old sound. That is UDP's sweet spot.

Ports work with both

Both protocols use port numbers to direct traffic to the right application. A single device can run many services at once because each listens on its own port — web traffic on port 443, for example — over either TCP or UDP.

The modern blur

Newer protocols sometimes get the best of both. For instance, the QUIC protocol behind modern web connections runs over UDP but rebuilds reliability and ordering itself, avoiding some of TCP's delays. The underlying trade-off, though, never disappears: you are always balancing guaranteed delivery against raw speed.

🦆 Check your own IP address