[ENet-discuss] Packet flags usage

Lee Salzman lsalzman at gmail.com
Mon Jun 6 02:57:09 PDT 2011


ENET_PACKET_FLAG_RELIABLE
ENET_PACKET_FLAG_UNSEQUENCED
ENET_PACKET_FLAG_UNSEQUENCED + ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT
ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT

Those are basically the only used combinations of those flags. ENET_PACKET_FLAG_NO_ALLOCATE works with any of them.

I make no promises as to the reserved status of unused bits in the packet flags. If you use a bit that I happen to need for a new flag, you're out of luck. But I am likely to only use bits in sequence, so if you must use some bits for your own purposes, use the higher bits, not the lower ones.

On 06/06/2011 05:27 PM, Benoit Germain wrote:
> Hello,
>
> Just wanted to know which packet flag combinations are legal?
>
> Currently  we have
>
>     ENET_PACKET_FLAG_RELIABLE
>     ENET_PACKET_FLAG_UNSEQUENCED
>     ENET_PACKET_FLAG_NO_ALLOCATE
>     ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT
>
> I suppose that ENET_PACKET_FLAG_NO_ALLOCATE is a bit different, since
> it is specified at packet creation, not when packet is sent.
> But regarding the 3 other flags, the doc ENetPacket doc says: "... The
> flags field is either 0 (specifying no flags), or a bitwise-or of any
> combination of the following flags".
> However, I have difficulty imagining what I get when using
> ENET_PACKET_FLAG_RELIABLE + ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT.
> It also says that ENET_PACKET_FLAG_UNSEQUENCED is not supported for
> ENET_PACKET_FLAG_RELIABLE.
>
> So, all in all, it looks like we can have 4 or 5 legal combinations:
>
> ENET_PACKET_FLAG_RELIABLE
>
> ENET_PACKET_FLAG_UNSEQUENCED
>
> ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT
>
> ENET_PACKET_FLAG_UNSEQUENCED + ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT
>
> ENET_PACKET_FLAG_RELIABLE + ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT ?
>
> Is this correct?
>
> Also regarding packet flags, I happen to use another bit for my own
> purpose. It doesn't seem to hurt ENet operations, and I haven't seen
> code that could be affected by this. But is is something I can
> dependably rely on?
>
>
> Regards,
>
>



More information about the ENet-discuss mailing list