Reading pipe asynchronously using ReadFile
Reading pipe asynchronously using ReadFile I think I need some clarification on how to read from a named pipe and have it return immediately, data or not. What I am seeing is ReadFile fails, as expected, but GetLastError returns either ERROR_IO_PENDING or ERROR_PIPE_NOT_CONNECTED, and it does this until my surrounding code times out. I get these errors EVEN THOUGH THE DATA HAS IN FACT ARRIVED. I know this by checking my read buffer and seeing what I expect. And the pipe keeps working. I suspect I am not using the overlapped structure correctly, I'm just setting all fields to zero. My code looks like this: gPipe = CreateFile(gPipename, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); pMode = PIPE_READMODE_MESSAGE; bret = SetNamedPipeHandleState(gPipe, &pMode, NULL, NULL); OVERLAPPED ol; memset(&ol, 0, sizeof(OVERLAPPED)); // the following inside a loop that times out after a period bret = ReadFile(gPipe, &tmostat, sizeof(TMO64STAT), N...