TCP vs UDP Simulator
Interactive visualization showing the differences between TCP's reliable connection-oriented protocol and UDP's fast connectionless approach. See the 3-way handshake, packet loss, and retransmissions in action.
Category: Networking
Topics covered: networking, educational, interactive, protocols
// simulator
TCP vs UDP Simulator
Interactive visualization showing the differences between TCP's reliable connection-oriented protocol and UDP's fast connectionless approach. See the 3-way handshake, packet loss, and retransmissions in action.
Protocol Simulator
Visualize the 3-Way Handshake and Reliability mechanisms.
TCP Concept: Idle
(Sender)
(Receiver)
Ready to simulate
Simulation Control
Network Conditions
Experiment by increasing "Packet Loss" to see how TCP retries vs UDP just loses data.
Space play/pause · M toggle mode · R reset
Understanding TCP vs UDP
TCP (Transmission Control Protocol)
- Connection-oriented with 3-way handshake
- Guaranteed delivery and ordering
- Automatic retransmission of lost packets
- Flow control and congestion management
- Higher overhead but reliable
- Best for: HTTP, FTP, email, file transfers
UDP (User Datagram Protocol)
- Connectionless. No handshake required.
- No delivery or ordering guarantees
- No retransmission. Fire and forget.
- Minimal overhead, very fast
- Lower latency, higher throughput
- Best for: Streaming, gaming, VoIP, DNS
When to use each protocol
- Use TCP when data integrity is critical (banking, file downloads, web pages).
- Use UDP when speed matters more than reliability (live video, multiplayer games).
- Some apps use both: DNS queries over UDP, zone transfers over TCP.
- Modern protocols like QUIC combine benefits of both (HTTP/3).
Overview
TCP and UDP both carry data over IP, but they make opposite promises. This simulator sends packets between two hosts so you can watch the difference. In TCP mode the connection starts with the three-way handshake, SYN, SYN-ACK and ACK, then every data packet is acknowledged and anything lost is sent again, so all data arrives in order at the cost of extra round trips. In UDP mode packets are simply sent, with no handshake, no acknowledgements and no retransmission, so whatever is lost stays lost. You can change the simulation speed, add packet loss and add jitter, which gives each packet its own delay so later packets can overtake earlier ones. UDP hands them over out of order, while TCP holds an early packet until the gap before it is filled, and the counters show packets sent, received, lost, retransmitted and out of order. With loss turned up, TCP slows down as it retransmits, while UDP keeps sending at the same rate and drops data. That is why TCP is used where every byte matters, such as web pages, APIs and file transfers, and UDP where fresh data matters more than complete data, such as DNS queries, video calls, games and QUIC, which builds its own reliability on top of UDP.
Try this
- Start in TCP mode and watch the three-way handshake before any data is sent.
- Raise packet loss and compare the retransmit counter in TCP mode with the lost counter in UDP mode.
- Turn jitter up to 100% and compare the out-of-order counter in UDP mode with the held count in TCP mode, where early packets wait for the missing one.
Frequently asked questions
- What is the difference between TCP and UDP?
- TCP is connection oriented: it sets up a connection, acknowledges data, retransmits losses and delivers bytes in order. UDP sends independent datagrams with no delivery or ordering guarantees, which makes it lighter and lower latency.
- Why does DNS use UDP?
- Most DNS queries fit in one small request and response, so a connection setup would double the time. DNS falls back to TCP for large responses and zone transfers.
- What is the TCP three-way handshake?
- The client sends SYN, the server replies with SYN-ACK and the client answers ACK. After these three messages both sides have agreed on starting sequence numbers and can send data.
Try next
// simulator
Bounce Triage Simulator
Read a real SMTP bounce and decide what it is and what to do about it. Twelve genuine failures from Gmail, Outlook, Postfix and Proofpoint: hard bounces, soft bounces, content blocks, rate limits and spam complaints. Learn why the 4xx and 5xx class digit is a hint rather than the answer, which bounces to suppress permanently, which to retry, and what each mistake costs you in lost subscribers or lost sending reputation.
// simulator
DNS Resolution Simulator
Learn how DNS works with an interactive step-by-step simulator. Visualize the DNS hierarchy, understand caching at different levels, and see the difference between recursive and iterative queries.
// simulator
Kubernetes Networking / CNI Simulator
Visualize Kubernetes networking and CNI packet paths with an interactive simulator. Learn Pod-to-Pod routing, same-node and cross-node traffic, ClusterIP Services, EndpointSlices, headless Services, LoadBalancer, NodePort, kube-proxy, eBPF service routing, Ingress, NetworkPolicy, and internet egress.