Compare
Side-by-side on the decisions that recur: TCP vs UDP, HTTP/2 vs HTTP/3, flow vs congestion control, L4 vs L7, forward vs reverse proxy, IPv4 vs IPv6 — with when to choose each.
TCP vs UDPHTTP/2 vs HTTP/3Flow control vs Congestion controlSwitch vs RouterForward proxy vs Reverse proxyL4 load balancing vs L7 load balancingServer-Sent Events vs WebSocketsIPv4 vs IPv6ARP (IPv4) vs Neighbor Discovery (IPv6)Keep-alive (reuse) vs New connection per request
| Switch | Router | |
|---|---|---|
| Forwards by | Destination MAC address (layer 2) | Destination IP address, longest-prefix match (layer 3) |
| Learns from | Source MACs of frames it sees — a MAC table per port | Configured routes and routing protocols (OSPF, BGP) |
| Scope | One broadcast domain / LAN | Between networks; broadcasts stop here |
| Unknown destination | Floods the frame out every port | Uses the default route or drops with ICMP unreachable |
| Changes the packet | Nothing — the frame passes through | Rewrites source/destination MAC, decrements TTL |
| Typical failure | Loops (spanning tree), MAC table overflow, wrong VLAN | Missing route, black hole, asymmetric path |
| Choose this when | Connecting hosts inside one network segment — the office floor, a rack, a VLAN. | Connecting one network to another — the office to the internet, one subnet to the next, or any hop in between. |