Search⌘ K
AI Features

UDP Checksum Calculation & Why UDP?

Explore how UDP uses checksum calculations to detect message corruption and understand the reasons behind choosing UDP over TCP. This lesson helps you grasp UDP’s faster transmission, control advantages, and common applications like DNS and Xbox Live.

UDP detects if any changes were introduced into a message while it traveled over the network. To do so, it appends a ‘checksum’ to the packet as a field that can be checked against the message itself to see if it was corrupted. It’s calculated the same way as in TCP. Here’s a refresher with some extra information:

Checksum Calculation

  1. The payload and some of the headers (including some IP headers) are all divided into 16-bit words.
  2. These words are then added together, wrapping any overflow around.
  3. Lastly, the one’s complement of the resultant sum is taken and appended to the message as the checksum.

Note: Also, note that if a message cannot be perfectly divided into 16-bit chunks, then the last word is padded to the ...