TCP vs UDP

#Network #HTTP #TCP #UDP

General Overview

Factor TCP UDP
Connection type Requires an established connection before transmitting data No connection is needed to start and end a data transfer
Data sequence Can sequence data (send in a specific order) Cannot sequence or arrange data
Data retransmission Can retransmit data if packets fail to arrive No data retransmitting. Lost data can’t be retrieved
Delivery Delivery is guaranteed Delivery is not guaranteed
Check for errors Thorough error-checking guarantees data arrives in its intended state Minimal error-checking covers the basics but may not prevent all errors
Broadcasting Not supported Supported
Speed Slow, but complete data delivery Fast, but at risk of incomplete data delivery

how TCP works

Additional Insights

Modern Usage of TCP and UDP

HTTP (HyperText Transfer Protocol)

HTTP/2

HTTP/3

Summary

Protocol Transport Layer Key Features
HTTP TCP Reliable, ordered, error-checked delivery. Persistent connections in HTTP/1.1.
HTTP/2 TCP Multiplexing, header compression, server push, binary protocol.
HTTP/3 UDP (QUIC) Faster connection establishment, multiplexing without head-of-line blocking, improved congestion control, built-in encryption.

Reference