lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On 22 Nov 2006, at 12:08, Dave Dodge wrote:

On Mon, Nov 20, 2006 at 07:22:13PM +0100, lua@zevv.nl wrote:
Nonblocking mode should never be necassery when using select(),
because of the proper behaviour of recv() as I described above.

Just a quick note that this is not necessarily true.

As I recall: for performance reasons Linux sockets are marked readable
when packets arrive, _before_ the packet checksums are tested.  So a
corrupt packet can cause select() to report the socket as readable,
and a recv() call can then block when the delayed checksum test causes
the packet to be discarded.  I think this has been observed causing
real problems with some UDP-based daemons.

Sure. Just because select says something is readable doesn't mean that your next read won't block. This has been SOP for unix since time immemorial.

drj