Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Bit fields

2010-06-07 by Russell Shaw

David VanHorn wrote:
>> You could subtract the sequence number of the last packet of the last
>> batch from the highest sequence number packet of the latest batch of
>> received packets. The difference should agree with a counter for the
>> packets received in this batch so far.
> 
> I think I follow you, but I don't see how this tells me wether I've
> received all of them.
> Not that I expect this, but say the last packet arrives first...
> Or the middle packet arrives three times. (very possible)

You receive the packets in batches, say 32 at a time. After each
batch, reset the counter to zero. The counter increments on each
packet received, so if the last packet of this batch is received
first, the counter is now 1. If the seq number of this packet is
63 and you subtract the last seq number of the last batch (31),
you get 32. So there's now 32 - 1 or 31 more packets to receive.

The batch size is 32 in this example (size of your "sliding window").

On alternative way to restate:

You receive the packets in batches, say 32 at a time. After each
batch, reset the counter to 32. The counter decrements on each
packet received. The counter shows how many more packets are
missing for this batch. When the counter reaches zero, you
advance to the next batch and repeat (window is slid to
next batch). As a check, make sure the seq no of each
received packet is in your current window range. Discard
those that are deemed to be duplicates by the protocol.

Depending on the protocol, packets for the next batch could
arrive prematurely. You could have a second storage area for
the next batch already set up if needed. Hopefully the protocol
would avoid the need for that.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.