bit_twiddler
2006-12-05 01:21:15 UTC
I'm having trouble with using InternetReadFile in async mode.
I do the following:
o InternetOpen in async mode
o set callback function
o create and reset an event
o InternetOpenURL
o wait for event to signal
loop:
o reset event
o InternetReadFile
o wait for event to signal
where my callback signals the event on read complete status.
Now occasionally what happens is InternetReadFile will return false and
last error is
ERROR_IO_PENDING, which is normal, and I call WaitForSingleObject on my
event
object, and that will return WAIT_OBJECT_0 which indicates that the
object is signalled,
but I my callback never received the read complete status. And given
that this condition
is the only place where I signal my event I don't see how
WaitForSingleObject can be
returning signalled.
If I then ResetEvent and wait again, then I get the correct result.
Anyone have any ideas, or at least had similar experiences and want to
commiserate?
Thanks.
I do the following:
o InternetOpen in async mode
o set callback function
o create and reset an event
o InternetOpenURL
o wait for event to signal
loop:
o reset event
o InternetReadFile
o wait for event to signal
where my callback signals the event on read complete status.
Now occasionally what happens is InternetReadFile will return false and
last error is
ERROR_IO_PENDING, which is normal, and I call WaitForSingleObject on my
event
object, and that will return WAIT_OBJECT_0 which indicates that the
object is signalled,
but I my callback never received the read complete status. And given
that this condition
is the only place where I signal my event I don't see how
WaitForSingleObject can be
returning signalled.
If I then ResetEvent and wait again, then I get the correct result.
Anyone have any ideas, or at least had similar experiences and want to
commiserate?
Thanks.