Questions tagged [overlapped-io]

138 questions
4
votes
1 answer

is the overlapped structure updated when using ReadFile?

I'm learning something on win32 programming. I read on the reference manual (here: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365467%28v=vs.85%29.aspx ) that If lpOverlapped is not NULL, the read operation starts at the offset that…
gtatr
  • 6,947
  • 1
  • 17
  • 27
4
votes
2 answers

Should I use AcceptEx() or WSAAccept()?

I am using Overlapped IO, I want to accept client connections using a blocking call, the same way I do with a normal accept(). I am not sure but I think that AcceptEx() does not block, while WSAAccept() does. So is WSAAccept() similar to accept()?
user4582812
  • 591
  • 1
  • 4
  • 16
4
votes
2 answers

Usage of overlapped named pipe for simultaneous read and write on Windows

I have a pipe handle that was created as overlapped. I need to read and write data to it in parallel. How can I achieve this? Named Pipe Server Using Overlapped I/O documentation page shows an example how to read and write to many pipes, but "it…
Dmitry Trofimov
  • 7,371
  • 1
  • 30
  • 34
4
votes
1 answer

Why does GetOverlappedResult need the file handle?

Why does GetOverlappedResult need a file handle? It seems like WaitForSingleObject(overlapped->hEvent) should be enough to wait on the event so that the overlapped I/O finishes, so what does GetOverlappedResult use the file handle for?
user541686
  • 205,094
  • 128
  • 528
  • 886
3
votes
2 answers

TCP connections with overlapped I/O

Is it possible to initiate a TCP connection request with overlapped I/O, and cancel it before the connection has been completed in Windows? I need to support at least Windows XP SP2.
Jörgen Sigvardsson
  • 4,839
  • 3
  • 28
  • 51
3
votes
2 answers

Reading named Pipe using overlapped/asynchronous i/o

I have a real old code from a service that uses named named pipes in message mode (PIPE_TYPE_MESSAGE) with overlapped i/o (FILE_FLAG_OVERLAPPED). The code does the following: ReadFile for 4 bytes with overlapped i/o (header + message length). The…
xMRi
  • 14,982
  • 3
  • 26
  • 59
3
votes
1 answer

Race-free way to asynchronously start AND cancel I/O on another thread in Windows

Background: generally, if we want to force an operation to happen asynchronously (to avoid blocking the main thread), using FILE_FLAG_OVERLAPPED is insufficient, because the operation can still complete synchronously. So let's say that, to avoid…
user541686
  • 205,094
  • 128
  • 528
  • 886
3
votes
1 answer

When using WSASend in overlapped mode, when should I free the buffers?

I am using WSASend() to send some data with IOCP. I allocate a buffer and fill it with data to send, then create a WSABUF pointing to my buffer and pass it into WSASend(). The documentation says: If this function is completed in an overlapped…
ddulaney
  • 843
  • 7
  • 19
3
votes
2 answers

overlapping output while reading from fifo: how to fix/avoid this?

I am trying to aggregate data from 2 files, so I decided to send the data via separate writer processes to a named fifo, and launched a separate reader process to read and process the aggregated data. All reading/writing is happening on a ramdisk…
User9102d82
  • 1,172
  • 9
  • 19
3
votes
2 answers

Using and Overlapped Named Pipe in Python 3.7

I am using Windows with Python 3.7 and I am trying to asynchronly share data, ony strings, between to python processes. One of the is running indefinitely (reciever), the other one may start at any point sends some data and then ends (sender). I am…
Finn
  • 2,333
  • 1
  • 10
  • 21
3
votes
1 answer

Unexpected WSA_IO_PENDING from blocking (with overlapped I/O attribute) Winsock2 calls

Short version: I get WSA_IO_PENDING when using blocking socket API calls. How should I handle it? The socket has overlapped I/O attribute and set with a timeout. Long version: Platform: Windows 10. Visual Studio 2015 A socket is created in a very…
rnd_nr_gen
  • 2,203
  • 3
  • 36
  • 55
3
votes
0 answers

What is the maximum number of outstanding overlapped I/O requests allowed?

In the context of Overlapped I/O, WSASend() can return the error code WSAEWOULDBLOCK, which says: Overlapped sockets: There are too many outstanding overlapped I/O requests. Is the maximum number of outstanding overlapped I/O requests defined,…
Tom
  • 1,344
  • 9
  • 27
3
votes
1 answer

hEvent member in OVERLAPPED Win32 structure

When asynchronous I/O (or "overlapped" I/O in Win32 jargon) is used, we need to deal with the OVERLAPPED structure and his hEvent member. If the I/O function will delay the read or write operation, we will get an ERROR_IO_PENDING error code, then we…
lornova
  • 6,667
  • 9
  • 47
  • 74
3
votes
1 answer

Canceling a WinUSB asynchronous control transfer

For a user application (not a driver) using WinUSB, I use WinUsb_ControlTransfer in combination with overlapped I/O to asynchronously send a control message. Is it possible to cancel the asynchronous operation? WinUsb_AbortPipe works for all other…
madwizard
  • 31
  • 3
3
votes
3 answers

C# and native overlapped I/O

I have a C dll that I'm wrapping so that I can call it from C#. One function uses events to notify you when a state has changed, and figuring out to deal with it took some digging. It seems to be working ok, but I'm curious if anyone has more…
Eric McNeill
  • 1,784
  • 1
  • 18
  • 29
1
2
3
9 10