Questions tagged [overlapped-io]

138 questions
3
votes
1 answer

Is the lpNumberOfBytesTransfered parameter of GetOverlappedResult valid when GetLastError returns ERROR_OPERATION_ABORTED?

In my project I need to read from and write to a serial port (RS232). I am using overlapped IO and use two separate threads for reading and writing. When I issue a write operation that does not complete immediately, I start waiting…
R. Beiboer
  • 712
  • 9
  • 21
3
votes
2 answers

Overlapped IO or file mapping?

In a Windows application I have a class which wraps up a filename and a buffer. You construct it with a filename and you can query the object to see if the buffer is filled yet, returning nullptr if not and the buffer addres if so. When the object…
hatcat
  • 1,876
  • 1
  • 18
  • 37
3
votes
1 answer

Non blocking sockets with overlapped I/O

I'm trying to work myself through the socket jungle and came across non blocking sockets with overlapped I/O. I have three books at home which only mention this concept but don't really explain it or give me any examples. So what I'm looking for is…
user238801
2
votes
2 answers

How do you asynchronously resolve host names to IP addresses?

How do you asynchronously resolve host names to IP addresses, preferably with overlapped I/O? GetAddrInfoEx does not support overlapped I/O in Windows 7 and earlier. I am using native C++.
Joshua
  • 1,148
  • 3
  • 17
  • 34
2
votes
2 answers

How to tell when ReadFileEx() overlapped I/O has completed?

HasOverlappedIoCompleted() doesn't work on asynchronous I/O begun with ReadFileEx() and WriteFileEx(). The code snippet at the bottom demonstrates this. In this example, ReadFileEx() reads from a pipe that has no input, so the read will not…
Ian Goldby
  • 5,609
  • 1
  • 45
  • 81
2
votes
1 answer

Is it possible to recover an allocated OVERLAPPED structure used in a pending I/O operation?

Let's say you're doing an asynchronous operation (like ReadDirectoryChangesW) using I/O completion ports. And for each call to the function, you allocate an OVERLAPPED structure (perhaps with some additional data) for use within the I/O completion…
user15284017
2
votes
1 answer

Error handling in overlapped socket IO

Can anyone please suggest a reliable way to handle system errors in case of using overlapped socket IO and IOCP? MSDN description is cumbersome on this aspect. It says that for GetQueuedCompletionStatus return code FALSE there should be a subsequent…
Krit
  • 548
  • 3
  • 9
2
votes
1 answer

Resume completion port notification after they were stopped

In the MSDN doc for the lpOverlapped parameter of GetQueuedCompletionStatus it is said that the application can prevent completion port notification by setting the low-order bit of the hEvent member of the OVERLAPPED structure. But is it possible to…
neflow
  • 76
  • 3
2
votes
1 answer

(MSDN)Make thread "alertable" constantly without blocking the thread

I am using asynchronous process calls (APC) to do overlap I/O requests using ReadFileEx and WriteFileEx. As defined in MSDN, these function's completion routines(APCs) will only be handled if the thread, which defines APCs, is under "alertable"…
ctheadn8954
  • 129
  • 1
  • 8
2
votes
3 answers

Is it normal for WSASend to fail during big file transfers?

I need a little help if someone's got a minute. I've written a web server using IO completion ports, but I am having some trouble sending out large files. Web pages seem to load fine, but during large file transfers, WSASend() fails after a few…
CuriousGeorge
  • 7,120
  • 6
  • 42
  • 74
2
votes
1 answer

Business logic in IO completion Port

I have some doubts in regards of IO Completion Port as well as AcceptEx in winsock2 Please correct me if i am wrong. AcceptEx is an overlapped way of accepting requests or connection. However, as pointed out by multiple posts on this site that…
2
votes
2 answers

Why IOCP is used?

I am trying to understand why IOCP is used. I can think of two reasons: Since WSARecv() will not block, then I can handle 1000s of clients without having to create a new thread for each client (also, there is a limit on how many threads you can…
user4572253
2
votes
1 answer

What does context information means when talking about Overlapped I/O?

In the documentation for WSARecv(), it says: If lpCompletionRoutine is not NULL, the hEvent parameter is ignored and can be used by the application to pass context information to the completion routine. What does "context information" means? I…
user4572253
2
votes
1 answer

How does Overlapped I/O relates to the concept of blocking and non-blocking sockets?

I am wondering does using Overlapped I/O means that I am using the socket in a non-blocking mode, or does the concept of blocking and non-blocking sockets is not related to the concept of Overlapped I/O.
John
  • 1,049
  • 1
  • 14
  • 34
2
votes
0 answers

How can I accept() multiple sockets using Overlapped IO?

I am having a problem understanding how can I accept multiple sockets (quickly) when using Overlapped IO (with Completion Routines). So in my server this is the pseudo code: while(true) { sock = accept(); WSARecv(sock, callback_function); …
user4592590
1 2
3
9 10