[ENet-discuss] Newby Question

Giuseppe Greco giuseppe.greco at agamura.com
Fri Aug 17 08:31:48 PDT 2007


Many thanks for the explanation,
j3d.

On Fri, 2007-08-17 at 07:19 -0700, Lee Salzman wrote:
> I do some trickery to compress a 32 bit sequence number into 16 bits. 
> This saves a huge amount of bandwidth on little packets.
> 
> If the sequence number received so far on a channel are all at the high
> end of the 16 bit range, but you received a sequence number at the low 
> end, that, without much loss, you can assume that it was just a sequence 
> number that wrapped around back to the low end again, hence, it should 
> be really treated as a number 2^16 greater than it actually is. That's
> what that first test does. In this case, ">= 0xF000" being the high end,
> and "< 0x1000" being the low end.
> 
> The second test just checks if the sequence number is old, i.e. if even
> after adjustment the sequence number is less than the ones already received.
> 
> It is almost impossible that you will have anywhere near to 2^16 packets 
> in flight at any given tme, so that's what makes this sort of 
> compression possible.
> 
> Lee
> 
> Giuseppe Greco wrote:
> > HI guys,
> > 
> > I'm trying to learn ENet so I'm looking at the source code...
> > Nice stuff, you did really a great job!!! I've just a question:
> > 
> > In file peer.c, function enet_peer_queue_incoming_command, what
> > is the purpose of lines 563-567?
> > 
> > if (channel -> incomingReliableSequenceNumber >= 0xF000 &&
> >         reliableSequenceNumber < 0x1000)
> >     reliableSequenceNumber += 0x10000;
> > 
> > if (reliableSequenceNumber < channel -> incomingReliableSequenceNumber
> >         || (channel -> incomingReliableSequenceNumber < 0x1000
> >         && (reliableSequenceNumber & 0xFFFF) >= 0xF000
> >     goto freePacket;
> > 
> > For instance, could you explain me what are you testing here?
> > 
> > Tx a lot,
> > j3d.
> > 
> 
> _______________________________________________
> ENet-discuss mailing list
> ENet-discuss at cubik.org
> http://lists.cubik.org/mailman/listinfo/enet-discuss
-- 
----------------------------------------
Giuseppe Greco
::agamura::

call giuseppe.greco via Skype
phone:  +41 (0)91 604 67 65
mobile: +41 (0)79 590 33 06
email:  giuseppe.greco at agamura.com
web:    www.agamura.com
----------------------------------------



More information about the ENet-discuss mailing list