TCP (Transmission Control Protocol) là kết nối hướng kết nối (connection-oriented): đảm bảo gói tin đến đúng thứ tự, không mất mát nhờ ACK/retransmit, kiểm soát tắc nghẽn — nhưng tốn overhead hơn. UDP (User Datagram Protocol) là connectionless: gửi gói tin không cần thiết lập kết nối, không đảm bảo thứ tự hay delivery, nhưng latency thấp hơn nhiều.
Dùng TCP khi tính toàn vẹn dữ liệu quan trọng: HTTP/HTTPS, database queries, file transfer, email.
Dùng UDP khi latency ưu tiên hơn độ chính xác: game online (vị trí nhân vật), VoIP/video call (mất vài frame chấp nhận được), DNS queries, DHCP. HTTP/3 dùng QUIC protocol xây trên UDP để giảm latency kết nối nhưng tự implement reliability ở tầng application.
TCP (Transmission Control Protocol) is connection-oriented: it guarantees in-order, lossless delivery through ACKs and retransmits, and includes congestion control — at the cost of higher overhead. UDP (User Datagram Protocol) is connectionless: packets are sent without establishing a connection, with no ordering or delivery guarantees, but with much lower latency.
Use TCP when data integrity matters: HTTP/HTTPS, database queries, file transfers, email.
Use UDP when latency is more important than accuracy: online games (player positions), VoIP/video calls (a few dropped frames are acceptable), DNS queries, DHCP. HTTP/3 uses the QUIC protocol built on top of UDP to reduce connection latency while implementing its own reliability at the application layer.