Skip to main content
PreparationZone Logo
PrepZone

Network Protocols

TCP, UDP, HTTP and TLS — the transport stack every distributed system sits on.

Pass checkpoint below

Read these first

The protocol stack

Layers bottom to top

  • IP (Layer 3) — addresses and routes packets between hosts; no delivery guarantee.
  • TCP / UDP (Layer 4) — transport: reliability vs speed.
  • TLS (Layer 4–5) — encryption and identity on top of TCP.
  • HTTP/1.1, HTTP/2, HTTP/3 (Layer 7) — request/response semantics for APIs and web.
  • WebSocket — full-duplex channel over HTTP upgrade (covered in a later article).
Java
Application  │  HTTP GET /api/v1/feed
TLS          │  encrypted record
TCP          │  segment, port 443
IP           │  packet, src → dst

Network stack (StreamHub request)

NETWORKL7 HTTP/2 + RESTAPI Gateway / ALB
NETWORKL4 TCPALB → EKS targets
NETWORKL3 IP + VPCsubnets · security groups
NETWORKDNSRoute 53 resolves hostname
Where HTTP/2, TLS, TCP, and DNS each sit in a cloud API call.

TCP vs UDP

AspectTCPUDP
DeliveryGuaranteed, orderedBest effort, no order guarantee
Connection3-way handshake, statefulConnectionless
OverheadHigher (retransmits, flow control)Lower latency
Use casesHTTP, APIs, databasesDNS, video streaming, gaming, VoIP
  • Delivery

    TCPGuaranteed, ordered
    UDPBest effort, no order guarantee
  • Connection

    TCP3-way handshake, stateful
    UDPConnectionless
  • Overhead

    TCPHigher (retransmits, flow control)
    UDPLower latency
  • Use cases

    TCPHTTP, APIs, databases
    UDPDNS, video streaming, gaming, VoIP

Default to TCP for APIs; choose UDP when loss is acceptable and latency dominates.

StreamHub uses TCP for all API traffic and metadata. Live low-latency preview streams experiment with UDP-based protocols (WebRTC) where occasional frame loss is acceptable.

The rest of this guide is part of Pro

Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.

Still to come · 5 sections

  • HTTP versions
  • TLS essentials
  • Connection lifecycle and latency
  • Ports and firewalls
  • Protocol choice for APIs

Test yourself

Answer these before moving on — recall is what makes it stick.