Original Post
I'm using enet for networking. It uses normal, non-blocking, non-overlapped Winsock 1.1 sockets. For some reason, my file reading code is interfering with it. Using a normal, synchronous fread, everything is fine. But when I enable my Overlapped IO file reading (which works fine when not using enet), I receive an access violation inside enet when it calls WSASendTo (this is the first socket operation performed after creating the socket/setting options).
All I'm doing in my file io code is calling ReadFileEx with the overlapped struct set, and no completion routine. I then poll all of the operations in progress every frame using HasOverlappedIoCompleted.
Does anyone have any idea why this might be happening? I need async file operations (I guess I could dump them on the thread pool but, eh) and I don't want to write my own socket library (at least not yet)
The only lead I have at this point is that I call sleep each frame in the main thread. If I change this to SleepEx (which should cause the thread to be woken up when an overlapped IO operation completes), I receive an access violation on the SleepEx call.
All I'm doing in my file io code is calling ReadFileEx with the overlapped struct set, and no completion routine. I then poll all of the operations in progress every frame using HasOverlappedIoCompleted.
Does anyone have any idea why this might be happening? I need async file operations (I guess I could dump them on the thread pool but, eh) and I don't want to write my own socket library (at least not yet)
The only lead I have at this point is that I call sleep each frame in the main thread. If I change this to SleepEx (which should cause the thread to be woken up when an overlapped IO operation completes), I receive an access violation on the SleepEx call.