TL;DR

TCP is a connection-oriented, reliable byte-stream protocol; UDP is connectionless and best-effort. Choose TCP when correctness matters, UDP when latency and real-time behavior matter.

Comparison

AspectTCPUDP
ConnectionThree-way handshakeNone
ReliabilityACKs, retransmission, dedupNot guaranteed
OrderingGuaranteedNot guaranteed
Flow/congestion controlYesNo
Header20–60 bytes8 bytes
ModelByte streamDatagram

Typical Uses

Sources

最后更新:2026-08-02