The difference between the two is the first version is reading a fixed number of bytes, blocking until all the data is recived, and the second is only reading out the exact number of bytes that have currently been buffered. The second version ensures that the stream read function won't block, but it also might not have all the data you expect if your message is larger than the endpoint size.
If you need to read in a larger message but don't want to block, you can use the last parameter to get the number of bytes actually read, and use that to accumulate the reads until the entire message has been read. When given the out size parameter, the stream read functions will update it and exit immediately once all the buffered data has been read out, instead of blocking. It's then the responisbility of your program to keep calling the stream read functions until you've got all the data you need to process the message.
Cheers,
- Dean
--
You received this message because you are subscribed to the Google Groups "LUFA Library Support List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lufa-support...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lufa-support/672d559a-a48d-4fdf-b67d-a869beab4698n%40googlegroups.com.