Can a TCP checksum fail to detect an error? If yes, how is this dealt with?

后端 未结 6 1128
别跟我提以往
别跟我提以往 2020-12-04 12:57

If a TCP payload gets corrupted in transit the recomputed checksum won\'t match the transmitted checksum. Great, all fine so far.

If a TCP checksum gets corrupted in

6条回答
  •  春和景丽
    2020-12-04 13:34

    Assume

    packet payload: 1000 byte

    packet checksum: 2 byte

    probability of packet with double error, one of wchich in checksum (assume P very small, less than 1/10^5):

    A = 8P*(1000*8P) = 6*10^4 * P^2
    

    probability of exact checksum:

    B = 1/2^16 = 6/10^4
    

    probability of false positive:

    A * B = 40 * P^2 
    

    The probability is low (P=1/10^6, then the probability of false positive A*B=4/10^11) but in any case with any crc algorithm it can't be zero. The probability of a random 1000 byte packet to appear as another random 1000 byte packet is P^8000, as if all bytes contain errors.

    If P is high, for example from 1/10^3 to 1, the calculations above does not apply. In that case A=1 (all packets contain double errors) and the probability of false positive is just A*B = 6/10^4. It's not a very relevant case because more than 99% of received packets will contain errors in crc.

提交回复
热议问题