When setting up servers and services I used to wonder why people would use UDP. It’s annoying to setup and test with firewalls, however lately while doing my CCNA study I have learned the important uses of UDP and TCP.
TCP has lots of features, like error recovery and acknowledgment which UDP doesn’t support. Both use “ports” and both have error detection. So why use UDP?
I’ve linked to a flickr scan of TCP header. As you can see a TCP header is 20 Bytes long, without it’s payload, where as if you look at a UDP header it’s only 8 Bits long. UDP already has the advantage of being smaller in size, but what really makes UDP useful is it’s lack of error recovery.
In services like VoIP , Video Conferencing and Gaming, by the time TCP has detected an error, sent a request for the missing packet, and continued on it’s way it has interrupted the call, making TCP a bad choice. Since UDP doesn’t have error handling, it doesn’t matter if a packet was lost or damaged, because UDP won’t request (or check) for the missing packet and continue on it’s merry way. Thus keeping the call at low latency.
Ps. Now that I have gotten half way through the first Cisco CCNA book I might share a few other network tips, tricks or info.
