Questions tagged [overlapped-io]
138 questions
1
vote
1 answer
ReadFileEx() completion routine not called
I am writing a class (PipeReader) to handle named pipes on Windows. The class uses asynchronous IO to read from the pipe.
So far I have been using the class in a thread without an event loop and I had to wait on the IO to finish using SleepEx() and…

Benjamin T
- 8,120
- 20
- 37
1
vote
0 answers
Windows overlapped I/O and c++ condition_variable
I have an object X that works in its own thread and sometimes signals with (std::condition_variable) some_cv.notify_all().
I also have another object Y that perfoms overlapped read from Windows named pipe. Then I need Y to wait for either…

Dmitry J
- 867
- 7
- 20
1
vote
0 answers
Interop, overlapped I/O, handles: use SafeHandle or pin?
When you are passing an unmanaged handle (stored in either IntPtr or SafeHandle at the managed side) from managed to unmanaged code to do overlapped I/O, what is the correct approach?
use a SafeHandle to wrap the (IntPtr) OS handle in,
or use…

Luc VdV
- 1,088
- 9
- 14
1
vote
1 answer
FTDI D2XX Cancelling overlapped IO (OIO) after a USB cable disconnect and reconnect
My application uses a USB based FTDI chip and the D2XX driver. It uses OIO (Overlapped IO) to read and write to the USB. My requirements include a 30 second timeout, something I cannot reduce. The code appear quite robust and stable.
A new…

user3097514
- 319
- 2
- 6
1
vote
2 answers
How to juggle FILE_SKIP_COMPLETION_PORT_ON_SUCCESS, IOCP, and cleanup
If FILE_SKIP_COMPLETION_PORT_ON_SUCCESS is set on a file handle that is bound to an I/O completion port, then an OVERLAPPED structure needs to be deallocated when its I/O completes synchronously.
Otherwise, it needs to stay alive until a worker…

user541686
- 205,094
- 128
- 528
- 886
1
vote
2 answers
Why is asynchronous IO preferred
So I've been doing some WIN32 socket programming and I'm trying to understand why Overlapped IO is preferred. In particular, I'm wondering why something like this
if (WSARecv(
socket,
dataBuf,
1,
…

FrozenHawk
- 150
- 2
- 8
1
vote
1 answer
Can I lock a 4GB or larger memory block by calling SetFileIoOverlappedRange multiple times?
Since the Length parameter of SetFileIoOverlappedRange is ULONG only, how can I lock a 4GB or larger memory block?
Say I allocate a contiguous 4 GB memory block to be used in overlapped I/O and call SetFileIoOverlappedRange twice, once for each half…

Ondrej Kelle
- 36,941
- 2
- 65
- 128
1
vote
0 answers
IO Completion Port UDP Socket, implementation and WSASendTo
I need to develop an application that uses IOCP in a UDP socket, but the material found both in the Microsoft documentation as other examples or are vague or focus in the form of implementation. I would like someone with experience in the use of…

Victor França
- 306
- 4
- 15
1
vote
1 answer
Should WSASocket() be used with IOCP?
I know that it is recommended to use WSAAccept() instead of accept() when creating an IOCP application. But I am not sure if WSASocket() belongs to the Overlapped I/O functions, or is it just another Winsock function?
user4344762
1
vote
1 answer
Why GetQueuedCompletionStatus() does not return operation type?
GetQueuedCompletionStatus() dequeue a completion notification, but it does not return what type of notification it is (e.g. Read notification, write notification).
It is my responsibility to keep track of what operations I initiate, for example when…

Tom
- 1,344
- 9
- 27
1
vote
0 answers
Error with ReadFile and Overlapped
I have a problem with ReadFile and overlapped.
first I use ReadFile with overlapped with 0
ZeroMemory(&overlapped ,sizeof(OVERLAPPED));
hDevice = CreateFileW(zwpath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,…

Makuvex Linux
- 91
- 1
- 2
- 6
1
vote
1 answer
storage and management of overlapped structure in multithreaded IOCP server
Is it good idea to use LINKED LIST to store overlapped structure?
my overlapped structure looks like this
typedef struct _PER_IO_CONTEXT
{
WSAOVERLAPPED Overlapped;
WSABUF wsabuf;
....
some other per…

maciekm
- 257
- 1
- 5
- 28
1
vote
0 answers
Asynchronous read operation on named pipe?
I want to receive data on named pipe asynchronously. Following is my server code:
bool bContinue = true;
bool bMessageReceived = false;
int iMessage;
DWORD dwBytesRead = 0;
OVERLAPPED oReadOverlapped = {0};
oReadOverlapped.hEvent = CreateEvent(NULL,…

user2731777
- 171
- 2
- 11
1
vote
1 answer
will socket async operation ever complete synchronously?
According to http://support.microsoft.com/kb/156932 there are conditions under which an asynchronous Disk IO operation may complete synchronously. Is this only applicable to Disk IO or can similar conditions apply to Network IO?
UPDATE:
i've tested…

Lawrence Ward
- 549
- 1
- 5
- 17
1
vote
2 answers
Why is the callback given to ReadFileEx() not receiving the correct OVERLAPPED structure?
For some reason, my callback isn't receiving the address of the correct OVERLAPPED structure after a call to ReadFileEx. What can cause this?
Update -- example:
#include
#include
void __stdcall completion_routine(
unsigned…

user541686
- 205,094
- 128
- 528
- 886