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
5
votes
2 answers

How can I wait on an I/O completion port and an event at the same time?

Is there any possible way to achieve this? For instance, I have an I/O completion port that 10 worker threads are pulling tasks out of. Each task is associated with an object. Some objects cannot be worked on concurrently, so if one thread is…
Collin Dauphinee
  • 13,664
  • 1
  • 40
  • 71
4
votes
4 answers

Is this program running Asynchronous or synchrounous?

When I run this program OVERLAPPED o; int main() { .. CreateIoCompletionPort(....); for (int i = 0; i<10; i++) { WriteFile(..,&o); OVERLAPPED* po; GetQueuedCompletionStatus(..,&po); } } it seems that…
user53670
4
votes
2 answers

Resources To learn IOCP On Windows

I recently was made aware of this thing called IOCP on windows and i began searching for more information on it but i couldn't find anything up to date (most of the examples were on codeproject almost 5 years old) and not too many guides or…
BRampersad
  • 862
  • 1
  • 12
  • 25
4
votes
3 answers

Choosing a IPC solution for an event-driven application

I am currently working on a rather large single-threaded, event-based, application designed around epoll under Linux and comparable technologies under other platforms. Currently, whenever we wish two instances to communicate, they typically do it…
Yoric
  • 3,348
  • 3
  • 19
  • 26
4
votes
3 answers

What is the best approach to send data in IOCP?

When calling WSASend(), I have to pass it a WSAOVERLAPPED instance, and I cannot re-use this WSAOVERLAPPED instance until the previous WSASend() operation has been completed (i.e. when a completion packet has been placed in the completion port, and…
Steve
  • 691
  • 5
  • 18
4
votes
2 answers

Is there any way to use IOCP to notify when a socket is readable / writeable?

I'm looking for some way to get a signal on an I/O completion port when a socket becomes readable/writeable (i.e. the next send/recv will complete immediately). Basically I want an overlapped version of WSASelect. (Yes, I know that for many…
Nathaniel J. Smith
  • 11,613
  • 4
  • 41
  • 49
4
votes
2 answers

Why Socket.AcceptAsync isn't firing SocketAsyncEventArgs Completed event?

I'm developing a Server application which will receive messages and respond. Nothing really new. So, actually I'm following this answer and this post, but I can't get the AcceptAsync() method to fire the Completed event. Searched everywhere on…
Afonso Lage
  • 281
  • 5
  • 18
4
votes
2 answers

"Un-associate" socket from completion port

CreateIoCompletionPort() is used to associate a socket with a completion port. However, when this socket is closed, then I need to "un-associate" it from the completion port. How can I do that?
Tom
  • 1,344
  • 9
  • 27
4
votes
0 answers

Does Python have iocp support?

While stumbling upon the newly introduced selectors module, I was wondering why all the major I/O waiting mechanisms are available but iocp. Is there somewhere a plugin with iocp functionality?
nullptr
  • 650
  • 3
  • 14
4
votes
1 answer

Is calling WSASend() and WSARecv() from two threads safe when using IOCP?

Based on this article, calling WSASend() or WSARecv() from multiple threads is not safe. However, is it safe to call WSASend() and WSARecv() at the same time from two threads?
user4592590
4
votes
1 answer

I/O Completion Ports *LAST* called callback, or: where it's safe to cleanup things

I guess this argument is important and deserve some space here. Let's consider the most common design of I/O Completion Ports in C/C++, having a structure (or a class) which abstract the HANDLE, and some of its properties, like this: class Stream…
Marco Pagliaricci
  • 1,366
  • 17
  • 31
4
votes
2 answers

IO Completion Ports and OVERLAPPED management

How win32 manages instances of OVERLAPPED struct in context of two functions: GetQueuedCompletionStatus PostQueuedCompletionStatus When I call GetQueuedCompletionStatus does win32 free instance of OVERLAPPED struct or I must do it by my self? When…
Edward83
  • 6,664
  • 14
  • 74
  • 102
4
votes
1 answer

IO Completion ports: How does WSARecv() work?

I want to write a server using a pool of worker threads and an IO completion port. The server should processes and forwards messages between multiple clients. The 'per client' data is in a class ClientContext. Data between instances of this class…
Olliwaa
  • 59
  • 1
  • 5
4
votes
2 answers

IOCP loop termination may cause memory leaks? How to close IOCP loop gracefully

I have the classic IOCP callback that dequeues i/o pending requests, process them, and deallocate them, in this way: struct MyIoRequest { OVERLAPPED o; /* ... other params ... */ }; bool is_iocp_active = true; DWORD WINAPI WorkerProc(LPVOID…
Marco Pagliaricci
  • 1,366
  • 17
  • 31
4
votes
1 answer

SocketAsyncEventArgs.Completed doesn't fire in Windows 8

When I compile this code on a machine with Windows 7 Ultimate and .NET 4 installed, it works just fine but when I try it on one with Windows 8 RTM and .NET 4.5 installed, Complete event never fires. class Program { private static Socket _Socket…
Şafak Gür
  • 7,045
  • 5
  • 59
  • 96
1 2
3
23 24