Re: [REGRESSION] Select hang with zero sized UDP packets
From: One Thousand Gnomes
Date: Wed Aug 24 2016 - 09:43:46 EST
On Wed, 24 Aug 2016 11:22:09 +0300
"Dan Akunis" <dan.akunis@xxxxxxxxx> 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)