31 Oct
2007
31 Oct
'07
3:13 a.m.
Ryan Melendez wrote:
recvfrom() blocks on datagram sockets just like any other type of socket unless it gets a S0_RCVTIMEO or the O_NONBLOCK is set (in which case you would receive an error).
Hmm... I guess I hadn't run into that before, because select() never lied about data being available. The simplest solution on your system is to set O_NONBLOCK on the sockets. But that is just a work-around for the kernel bug (i.e. race condition). If data is ready on a socket, it means that data is ready... blocking on the recvfrom() after telling the application that data is ready is not very nice. Alan DeKok.