Questions tagged [iocp]

An I/O Completion Port (IOCP) provides a way to execute asynchronous I/O operations efficiently on Windows.

An I/O Completion Port (IOCP) provides a way to execute asynchronous I/O operations efficiently on Windows.

It can be used by the native CreateIoCompletionPort() function. It's also used internally by some of the types that use the Begin*-End* asynchronous programming model in .Net.

350 questions
7
votes
3 answers

CloseHandle() returns before the serial port is actually closed

I'm pulling my hair trying to figure out when a serial port finishes closing so I can reopen it. It turns out that CloseHandle() returns before the port is actually unlocked. I am opening a serial port using CreateFile(FILE_FLAG_OVERLAPPED),…
Gili
  • 86,244
  • 97
  • 390
  • 689
7
votes
6 answers

What's the best way to ping many network devices in parallel?

I poll a lot of devices in network (more than 300) by iterative ping. The program polls the devices sequentially, so it's slow. I'd like to enhance the speed of polling. There some ways to do this in Delphi 7: Each device has a thread doing ping.…
Dr.eel
  • 1,837
  • 3
  • 18
  • 28
7
votes
3 answers

TCP/IP IOCP received data sometimes corrupt - Visual C++ on Windows

I am writing a simple test ICOP client and server to ensure I am using the API correctly and that the data the client sending is being received correctly by the server. I have included all the code for this question. This is where I ran into some…
David
  • 113
  • 1
  • 7
7
votes
3 answers

can the infamous `ERROR_NETNAME_DELETED' error be considered an error at all?

I'm writing a tcp server in Windows NT using completion ports to exploit asynchronous I/O. I have a TcpSocket class, a TcpServer class and some (virtual functions) callbacks to call when an I/O operation is completed, e.g. onRead() for when a read…
Marco Pagliaricci
  • 1,366
  • 17
  • 31
6
votes
2 answers

IOCP C++ TCP client

I am having some trouble implementing TCP IOCP client. I have implemented kqueue on Mac OSX so was looking to do something similar on windows and my understanding is that IOCP is the closest thing. The main problem is that GetCompetetionStatus is…
daltoniam
  • 579
  • 7
  • 13
6
votes
1 answer

SSL_read fails with SSL_ERROR_SSL

I am writing a https server. I have created csr and signed it using my root certificate for a test domain. When a client connects, SSL_accept() is done successfully. I am using Non- Blocking IO. So I will receive the data first in a char buffer…
mani_g
  • 151
  • 1
  • 2
  • 8
6
votes
1 answer

GetQueuedCompletionStatusEx() doesn't return a per-OVERLAPPED error code

I'm using the GetQueuedCompletionStatusEx() api, and I've just realized that it can indeed read N OVERLAPPEDs packets in just 1 syscall, instead of only 1 OVERLAPPED, like GetQueuedCompletionStatus(), but my concern is that I cannot know anything…
Marco Pagliaricci
  • 1,366
  • 17
  • 31
6
votes
6 answers

IO completion port key confusion

I'm writing an IO completion port based server (source code here) using the Windows DLL API in Python using the ctypes module. But this is a pretty direct usage of the API and this question is directed at those who have a knowledge of IOCP, not…
Richard Tew
5
votes
1 answer

IO Completion Port Initial Read and Bi-Directional Data

I have the following simplified IO Completion Port server C++ code: int main(..) { startCompletionPortThreadProc(); // Await client connection sockaddr_in clientAddress; int clientAddressSize = sizeof( clientAddress ); SOCKET…
Brent Campbell
  • 395
  • 1
  • 4
  • 12
5
votes
1 answer

WSAConnect() vs ConnectEx()

I am using IOCP in my client, but I find it more convenient to use a blocking call when connecting to the server. So is there any problem in using the blocking WSAConnect() instead of the non-blocking ConnectEx() when working with IOCP?
user6088487
  • 189
  • 6
5
votes
2 answers

Timer that supports overlapped I/O (for IOCP)?

I need to add timers support in an application based on I/O Completion Ports (IOCP). I would like to avoid the use of a specific thread to manage timers. On Linux, you can create a timer that delivers expiration notifications via a file descriptor…
Cédrics
  • 1,974
  • 11
  • 13
5
votes
1 answer

Is it possible to know how many unprocessed completed operations are queued on an IOCP through an API call?

I'm using C# sockets(which use IOCP for callbacks). I want a method to determine weather my processing logic is falling behind. Is there an API call that could give me the size of completed operations that haven't been processed by callbacks? I have…
Lawrence Ward
  • 549
  • 1
  • 5
  • 17
5
votes
1 answer

Async operations with I/O Completion Ports return 0 bytes transferred

Asynchronous operations with I/O Completion Ports return 0 bytes transferred, although the I/O operations work as expected (my read buffers become full). BYTE buffer[1024] = {0}; OVERLAPPED o = {0}; HANDLE file = CreateFile( _T("hello.txt"), …
5
votes
1 answer

Does an IO completetion port spawn a new thread before or after the completion port has something to report?

I am a bit confused as to what actually happens when an IO completion port completes. I presume that the Win API allows access to an IOCP queue that somehow is able to queue (or stack) a callback reference with a specific handle (let's say a…
kasperhj
  • 10,052
  • 21
  • 63
  • 106
5
votes
1 answer

When using IOCP, should I set WSAOVERLAPPED's hEvent to NULL or to a valid handle to a WSAEVENT object?

According to MSDN: hEvent: If an overlapped I/O operation is issued without an I/O completion routine (the operation's lpCompletionRoutine parameter is set to null), then this parameter should either contain a valid handle to a WSAEVENT…
jpen
  • 2,129
  • 5
  • 32
  • 56
1
2
3
23 24