Eric Pouech <[EMAIL PROTECTED]> writes: [...]
> > This turns out not to be the case. As long as lpOverlapped is > > supplied, a NULL hEvent will work fine and allows overlapped reads. > Could you also test it with opening a file (files and sockets > semantics are somehow different) I did, and it just returned the entire block in the ReadFile. I don't know how to open a file in a way that the ReadFile will not return immediately. The source code for this is a straightforward change to my earlier version; let me know if you'd like a copy. [...] > > The attached test program uses overlapped reads with a NULL hEvent in > > the OVERLAPPED structure to connect to an IP address and port given on > > the command line. Here's an example from Windows: > > C:>overlapped-test 216.12.213.139 25 > > Calling ReadFile > > ReadFile returned ERROR_IO_PENDING, as expected > > ov .hEvent=00000000 > > Calling Sleep(2000) > > Calling GetOverlappedResult > > GetOverlappedresult read 85 bytes: > > 220 2search2.com ESMTP Sendmail 8.10.2-SOL3/8.10.2; Mon, 17 May 2004 11:58:26 > > -0400 > just for fun, what gives without the Sleep ? Same results. Eric Pouech <[EMAIL PROTECTED]> writes: > Eric Pouech a �crit : > >> ...Windows doesn't do it this way, although according to the docs > >> other members of the overlapped structure are modified by Windows. > > Ok, we need to rewrite GetOverlappedResult to use the internal > > structures (and get the hEvent we might have created in ReadFile), > > instead of relying on the one from the overlapped struct itself > > Does the attached patch help ? Yes, it solves the problem completely for me. I have to admit I don't understand why it works, but thanks!! :) ---ScottG.
