On Wed, 24 Aug 2016 11:22:09 +0300 "Dan Akunis" <dan.aku...@gmail.com> wrote:
> When select wakes up on a UDP socket, user is expecting to get data. Getting > 0 from recvfrom() or whatever read function she uses, is a wrong attitude. > I agree with David. > > The unit test that expects select to wake up is wrong and should be changed. The unit test is correct. The behaviour of a 0 byte frame is actually well established and a 0 byte data frame is a meaningful message is several protocols. It is distinct from no pending data because that would report EWOULDBLOCK. It's more fun with regard to EOF but UDP has no EOF semantics. If you want to understand how to handle zero length datagrams in a connection oriented protocol the old DECnet documentation covers it in all its pain 8) Alan