[ENet-discuss] Incomplete/concatenated packets?

Sebastian Ahlman sebastian.ahlman at mbnet.fi
Thu Aug 18 06:14:07 PDT 2011


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