Winsock2 & overlapped IO

Mike McCormack mike_mccormack at start.com.au
Mon Nov 5 19:04:33 CST 2001


Hi Martin,

i don't know much about Winsock, but i can tell you how overlapped I/O
is supposed to work in Wine.

The bulk of the implementation is in files/file.c and
scheduler/synchro.c. When ReadFile is called on a handle, the
following happens:

1. check that the handle is valid and was opened with
FILE_FLAG_OVERLAPPED.
2. attempt to read any data that is available immediately, and perhaps
return if we read enough already.
3. queue the operation onto CurrentTeb()->pending_list

When the thread waits upon any server object, all (unix) fds with
pending overlapped operations are polled on. This is a minor problem
in the design; if the thread never waits upon an object the overlapped
can never complete, however the thread must wait upon the overlapped's
hEvent to check whether it has completed...

The only part of the serial comms overlapped implementation the lives
in the wineserver is the calculation of overlapped timeouts.

So to get winsock to do overlapped, you may have to modify the winsock
code to work like that... but the winsock code uses the service thread
to wait upon sockets. The task is definitely not impossible, but it
might take a bit of work :-)

Maybe Ove K. can give you some advice?

Mike


> In particular, it uses the Winsock 2 feature of "Overlapped IO"
> on sockets, with user-supplied callbacks that are called when
> data is received on a socket etc.
> 
> Browsing through the Wine Winsock code, I saw that this part of
> Winsock2 is obviously unimplemented.


------------------------------------------
mailto:Mike_McCormack at start.com.au
ph +82 16 430 0425

__________________________________________________________________
Get your free Australian email account at http://www.Looksmart.com.au





More information about the wine-devel mailing list