TCP: How are the seq / ack numbers generated?

前端 未结 8 1973
刺人心
刺人心 2021-02-01 20:50

I am currently working on a program which sniffs TCP packets being sent and received to and from a particular address. What I am trying to accomplish is replying with custom tai

8条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-01 21:15

    I have the same job to do. Firstly the initial seq# will be generated randomly(0-4294967297). Then the receiver will count the length of the data it received and send the ACK of seq# + length = x to the sender. The sequence will then be x and the sender will send the data. Similarly the receiver will count the length x + length = y and send the ACK as y and so on... Its how the the seq/ack is generated...

    If you want to show it practically try to sniff a packet in Wireshark and follow the TCP stream and see the scenario...

提交回复
热议问题