user855
user855

Reputation: 19918

In TCP protocol, is it possible for receiver to get packets with sequence numbers in this pattern?

In TCP protocol, is it possible for receiver to get packets with sequence numbers in this pattern?

oldest         newest
|               |
v               v
1 , 2, 3, 1, 2, 3

Specifically, the interesting bit is that after receiver gets packet 3, the next packet it gets is with sequence number 1.

The case I am imagining here is that the sender sent packets 1,2,3 very fast. For some reason the receiver got those packets late and so could not ACK those 3 packets in time. This causes the sender to re-send the 1,2,3 packets again. This leads to the above sequence with the receiver seeing the pattern 1,2,3,1,2,3.

This is possible in TCP correct?

Upvotes: 0

Views: 1036

Answers (2)

Steffen Ullrich
Steffen Ullrich

Reputation: 123375

In TCP protocol, is it possible for receiver to get packets with sequence numbers in this pattern?

Depends on what you mean with receiver.

If you mean with receiver the system: yes, since at the network layer packets might be duplicated, reordered etc.

If you mean with receiver the application: no, since the systems TCP/IP stack will take care of the duplicates and reordering and pass only the original byte stream in the right order and without duplicates to the TCP socket of the application. Note that in this case the receiver does not even gets packets: it gets only the byte stream and the packet boundary used during transport is neither known nor relevant.

Upvotes: 0

David Schwartz
David Schwartz

Reputation: 182779

Sure. It's possible in TCP because it's possible in IP. IP packets can be received out of order, duplicated, or dropped. The three packets might be sitting in a router's buffer when the link between that router and its upstream router is severed. The upstream router might re-transmit those packets on another link not realizing the first router also delivered them.

IP doesn't provide any guarantees about delays, repetition, packet loss, or ordering. That's why TCP has to implement all those guarantees itself.

Upvotes: 1

Related Questions