[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaSocket, Win32 and select()
- From: Mike Pall <mikelu-0501@...>
- Date: Fri, 28 Jan 2005 09:39:49 +0100
Hi,
the original socket API has (at least) one inherent flaw: it decouples
event notification from data delivery. This makes the API non-atomic.
This in turn leads to a number of race conditions. Most of them can
be worked around by the OS, but it's not reasonable to expect to be able
to fix all issues on any medium complex TCP/IP stack.
As much as I hate to say a good word about M$ products: The (native)
overlapped I/O API on Windows gets this right -- you get the event
notification _after_ the data is received into or sent from your user-space
buffer.
The standard socket API for Windows is just a (mediocre) compatibility
layer on top of it. Different OS internal event delivery paradigms are
at work here. Adapting between them leads to friction.
Bye,
Mike