lsalzman / enet

ENet reliable UDP networking library
MIT License
2.66k stars 667 forks source link

use ENET_PACKET_FLAG_UNSEQUENCED to send large messages #226

Closed Steamgjk closed 1 year ago

Steamgjk commented 1 year ago

I know that when we use ENET_PACKET_FLAG_RELIABLE to send large messages, ENet will guarantee that the receiver will receive the complete message reliably, and the application do not need to worry about the fragmentation of messages because ENet will have assembled the fragments for us. However, when we use ENET_PACKET_FLAG_UNSEQUENCED to send large message, whose size is larger than one UDP packet size and who will cause fragmentation in the network, then will ENET_PACKET_FLAG_UNSEQUENCED guarnatee that the receiver always receive complete messages, or not?

To be more clear, I understand ENET_PACKET_FLAG_UNSEQUENCED does not guarantee ordering or eventual delivery. However, if we send a large message, is it likely that the receiver side will only receive part of the message (i.e., fragments)? Or, will ENET_PACKET_FLAG_UNSEQUENCED guarantee that the receiver side receive "all-or-nothing" towards one large-sized message?

Thanks!

lsalzman commented 1 year ago

It's always all-or-nothing.