Interview Prep/Networking/Network Models, TCP, UDP & Ports

What is the difference between TCP and UDP?

BeginnerConceptNetwork Models, TCP, UDP & Ports
Answer

TCP is connection-oriented, reliable and ordered: handshake, sequence numbers, acknowledgements, retransmission, flow and congestion control. UDP is connectionless and best-effort: no handshake, no retransmission, no ordering, just a datagram with source and destination port.

Use TCP when you need every byte in order (HTTP/1.1, HTTP/2, SSH, databases). Use UDP when latency matters more than perfection or the application handles loss itself (DNS, VoIP, QUIC, WireGuard, syslog, metrics via StatsD).

All Networking questions Roadmap: Networking for DevOps

More on Network Models, TCP, UDP & Ports