Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

UDP and TCP use 1s complement for their checksums. Suppose you have the followin

ID: 3633297 • Letter: U

Question

UDP and TCP use 1s complement for their checksums. Suppose you have the following three 8-bit bytes: 01010101, 01110000, 01001100. What is the 1s complement of the sum of these 8-bit bytes?(Note that although UDP and TCP use 16-bit words in computing the checksum, for this problem you are being asked to consider 8-bit sums.) Show all work. Why is it that UDP takes the 1s complement of the sum; that is.
Why not just use the sum? With the 1s complement schema, how does the receiver detect errors? Is it possible that a 1-bit error will go undetected? How about 2-bit error?

Explanation / Answer

Sum of 1st two bytes:

01010101

01110000

_______

11000101

Adding 3rd byte to the sum:

11000101

01001100

________

100010001

Sum is 00010001

1s complement of sum: 11101110

UDP takes the complement instead of the sum because when the numbers are added all together including the checksum, it makes the number all ones and is used to identify errors.

Using this, the receiver detects the error by observing the sum of all the three bytes and the checksum. If it is all 1s then it is considered that there are no errors.

It is possible to detect the 1 bit errors. They cannot go undetected. But two bit errors cannot be detected because the sum remains same when two bits are flipped.