mediumConceptMidSenior
When would you choose UDP over TCP, given that TCP is reliable and UDP is not?
4 min readUpdated 2026-08-15
Answer
Short answer
TCP guarantees an ordered byte stream and pays for it with head-of-line blocking and retransmissions that arrive too late to be useful.UDP is right when a late packet is worthless, when you need multicast, or when you intend to build your own reliability with different trade-offs.
Was this answer helpful?
Likely follow-ups
- QUIC runs over UDP and is reliable. What did that let it change?
- You are sending 200-byte telemetry every second from 50,000 devices. Which do you pick and why?
- What does UDP do about congestion, and why should you care about being a good citizen?
- Why is DNS traditionally UDP, and when does it fall back to TCP?
Related questions
- Your application cannot reach a service that should be up. Walk me through diagnosing it from the shell.mediumAlso on networking and tcp6 min
- When would you reach for an abstract base class rather than a Protocol, and what does isinstance check in each case?hardAlso on protocols5 min
- If you were writing a small value type in Python, which dunder methods would you implement, what would you let a dataclass generate, and how does super() decide what to call?mediumAlso on protocols4 min
- Walk me through everything that happens when you type a URL into the browser and press enter.mediumAlso on tcp6 min