TransWikia.com

Confused with packet reordering

Network Engineering Asked by amjad on December 9, 2020

I was reading a textbook which says about TCP protocol "Selective Repeat":

We have assumed that packets cannot be reordered within the channel between the sender and receiver. This is generally a reasonable assumption when the sender and receiver are connected by a single physical wire. However, when the “channel” connecting the two is a network, packet reordering can occur. The approach taken in practice is to ensure that a sequence number is not reused until the sender is “sure” that any previously sent packets with sequence number x are no longer in the network. This is done by assuming that a packet cannot “live” in the network for longer than some fixed maximum amount of time.

I am confused and below are my two questions.

Q1-What does " the channel can be thought of as essentially buffering packets and spontaneously emitting these packets at any point in the future." mean? Why do we need to buffer an old packet? Isn’t it better that the receiver just ignore it?

Q2-Let’s say the window size is 2 and the available sequence number is 0,1,2,3.
The sender firstly sends packet 0, packet 1, while packet 0 is struck somehow and takes much time to arrive, so timeout occurs the sender has to send packet 0 again, but this time packet 0(new) arrives on time. Then the sender sends packet 2, packet 3, all received by the receiver. And then the sender is about to send packet 0(new), and packet 1(new), but the old packet 0 arrives at receiver now, so receive could not know that this packet is the old packet or the new packet. So how does " assuming that a packet cannot “live” in the network for longer than some fixed maximum amount of time" can fix this issue? Does it mean that the packet header contains the time that it was sent?

One Answer

What does " the channel can be thought of as essentially buffering packets and spontaneously emitting these packets at any point in the future." mean? why we need to buffer a old packet? isn't better that the receiver just ignore it?

That's the nature of queueing and buffering which is an essential part of packet switching - received packets are queued/buffered on ingress and deleted from the queue once they've been forwarded. Buffering is necessary as otherwise the egress link would always need to be free whenever a packet is received - that's not possible for packet-switched networks, only for circuit-switched ones.

Let say the window size is 2 and availabe sequence number is 0,1,2,3.

The window doesn't count packets/datagrams but bytes. Also, the sequence number only repeats when its 32-bit field overflows - that happens only after 4 GiB of data. However, that limit means that there can't ever be more than 4 Gib of data "in flight" to avoid ambiguity. Since the largest possible window is (close to) 1 GiB, that is not a problem.

Note that with simple, cumulative ACKs, the receiver can't selectively ACK later segments when a previous segment is still missing. An ACK means that all previous data has been received.

For example, with a segment size of 1,000 and a window size of 10,000, sender sends datagrams D00-D09 (sequence 0-9,999). D00 and D02-D09 are received, but D01 is lost. The receiver still ACKs 1,000 (the next expected data sequence) which triggers the sender to move D0 out of the window, advance it to 1,000-10,999, and send D10.

Meanwhile the receiver has decided that there's a problem, so it ACKs 1,000 again to signal just that. The sender receives the double ACK and resends D01 (reluctant mode) or all data starting from D01 (aggressive mode). The receiver has already got D10 (10,000-10,999), so it ACKs 11,000 which in turn moves the sender's window to 11,000-20,999 (and aborts the still outstanding retransmissions, for aggressive mode).

(I have somewhat simplified the process, in reality there's more parallel overlap, and a delay between send and receive, of course.)

EDIT: As Jeff has correctly pointed out (thx!), support for selective acknowledgments (SACK) is nearly a given today. Using that option, the receiver could also SACK 2,000-9,999 (from D02-D09) right away, so the sender wouldn't start retransmitting them. It could also start transmitting 11,000-20,999 earlier.

Correct answer by Zac67 on December 9, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP