Here's what I think would happen. I say "think" because I don't have a lot of practical UDP programming experience. Too much trouble compared to TCP/IP, but I understand your multi-cast requirement has you married to UDP...
Your app sends A, B, C, and D. The IP layer will fragment your payload into multiple packets (if required) based on the path MTU between your app and the multi-cast clients. Using A as an example, if a2 is lost, then the receiver's IP layer will not be able to reassemble the payload, nor will it be retransmitted, so the entire A payload is effectively lost. Based on that, I do not believe the IP layer would present any of a1,a3,a4 to your application, therefore readyRead() should not be signaled for any partial payloads.
Even if you only receive the full payload when none of the fragments are lost, they may still arrive out of order (BACD) or be duplicated (ABACD), or of course missing altogether.
Lastly, each readyRead() means there is data that is ready to be read from the socket. It does *not* mean that you have an even multiple of your payload. i.e. First readyRead() you may get all of A and part of B, etc. The next readyRead() will have the rest of B and whatever's next, etc. So, you'll want to append the data you readyRead() into a QByteArray or similar, so that you're always appending data read from the socket to your buffer and after each readyRead(), pick off the complete payloads from the start of the buffer and remove from buffer, etc.
It's commonplace to start your payload with an eye catcher, so you know if it's A, B, C, or D as well as the length (32-bit int) of the payload so that you can determine when you have received a full payload, etc. If you wanted to get fancy, you could even compute a checksum for your payload and send that along with the eye catcher and payload length fields.
Hope that helps and if anyone else has different thoughts regarding handling UDP, I'm all ears. I'd be interested to hear back from you once you start writing some code to share your findings, etc.
Good luck,
Jeff
Bookmarks