[ENet-discuss] Incomplete/concatenated packets?

Lee Salzman lsalzman at gmail.com
Wed Aug 17 23:04:55 PDT 2011


ENet is packet-oriented, not stream-oriented. The packets you put in are the packets you get out.

On 08/18/2011 04:14 PM, Sebastian Ahlman wrote:
> Hey guys, first time poster here. Wonderful lib you have created.
>
> One (possibly stupid) question though. I could not find any answer to this.
>
> Is it possible that the receiving peer only receives part of a packet or
> multiple packets at the same time? Eg. if I send a packet with
>
> ENetPacket *packet = enet_packet_create ("hello", strlen ("hello") + 1,
> ENET_PACKET_FLAG_RELIABLE);
>
> ...and then send another one from the same sender to the same receiver
> with...
>
> ENetPacket *packet = enet_packet_create ("world", strlen ("world") + 1,
> ENET_PACKET_FLAG_RELIABLE);
>
> ...is it possible that the receiving peer only receives "hel"? Or
> "helloworld"?
> What about "hellowo"?
>
> Also, does the ENET_PACKET_FLAG_RELIABLE affect this? I know that if I don't
> specify the flag there is no guarantee that the packet will make it's way
> through at all, but what about partial or "concatenated" packets?
>
> The reason I am asking is because I have implemented a simple RPC system
> on top
> of enet, and currently I just blindly expect one ENetPacket to be exactly one
> RPC command. Is this safe to do?
>
> Thanks!
>
> //Sebastian


More information about the ENet-discuss mailing list