TCP sequence number question

后端 未结 3 1894
Happy的楠姐
Happy的楠姐 2020-12-13 04:54

This is more of a theoretical question than an actual problem I have.

If I understand correctly, the sequence number in the TCP header of a packet is the index of th

3条回答
  •  天涯浪人
    2020-12-13 05:17

    It wraps. RFC 793:

    It is essential to remember that the actual sequence number space is finite, though very large. This space ranges from 0 to 2**32 - 1. Since the space is finite, all arithmetic dealing with sequence numbers must be performed modulo 2**32. This unsigned arithmetic preserves the relationship of sequence numbers as they cycle from 2**32 - 1 to 0 again. There are some subtleties to computer modulo arithmetic, so great care should be taken in programming the comparison of such values. The symbol "=<" means "less than or equal" (modulo 2**32).

    Read more: http://www.faqs.org/rfcs/rfc793.html#ixzz0lcD37K7J

提交回复
热议问题