Assume Linux and UDP is used.
The manpage of recvfrom says:
The receive calls normally return any data available, up to the requested amount, rather than waiting for receipt of the full amount requested.
If this is the case, then it is highly possible to return partial application level protocol data from the socket, even if desired MAX_SIZE
is set.
Should a subsequent call to recvfrom
be made?
In another sense, it's also possible to have more than the data I want, such as two UDP packets in the socket's buffer. If a recvfrom()
is called in this case, would it return both of them(assume within MAX_SIZE
)?
I suppose there should be some application protocol level size info at the start of each UDP msg so that it won't mess up.