Problem 3. UDP and TCP use 1s complement for their checksums. Suppose you have t
ID: 3791360 • Letter: P
Question
Problem 3. UDP and TCP use 1s complement for their checksums. Suppose you have the following three 8-bit bytes: 01010011, 01100110, 01110100. What is the 1s complement of the sum of the 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 that UDP takes the 1s complment of the sum; that is, why not just use the sum? With the1 s compliment scheme, how does the receiver detect errors? Is it possible that a 1-bit error will go undetected? How about a 2-bit error? Jim Kurose and Keith Ross,”Computer Networking – A Top-Down Approach”, Addison-Wesley, Seventh Edition, 2017. ISBN-13: 978-0-13-359414-0
Explanation / Answer
given 8-bit bytes are : 01010011, 01100110, 01110100
sum of them is as follows 01010011
01100110
(+) 01110100
----------------------------------
sum = 100101101
----------------------------------
now one's compliment of a number is obtained by replacing one's with zeros and vice versa .
here 1's compliment(100101101) = 01010010
Why is that UDP takes the 1s complment of the sum
The reason we do 1's complement is that when the 1's complement is added to the sum of all the values, and the result is trimmed to the bit-length of the machine (16 bits in the example above), it is all 1's. CPUs have a feature to take 1's complement of numbers, and taking the 1's complement of all-1 is all-0.
how does the receiver detects error :
The receiver checks the checksum by taking the 1s complement of the sum of the received data (including the checksum) and checking whether the result is all 1 bits. If any of the bits are 0, an error is indicated , otherwise a safe data transimission is assumed.
Is it possible that a 1-bit error will go undetected?
After receving the data the receiver checks the checksum by taking 1's compliment of the data recived if the result contains any zeros that will detect that a one bit error has occured , but two bit errors can be found through this method , if the last digit of the first word is converted to a 0 and the last digit of the second word is converted to a 1 this kind of error cannot be detected
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.