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
1
vote
1 answer

Unordered socket read & close notification using IOCP

Most server framework/examples using sockets and I/O completion ports makes notifications in a way I couldn't completely figure out the purpose. Upon read packets are processed, usually they are reordered to circumvent thread scheduling issues…
Mauro H. Leggieri
  • 1,084
  • 11
  • 25
1
vote
0 answers

GetQueuedCompletionStatus possible errors on failed with overlapped param null

I am building a server application using IOCP and most of the components are built so they can be re initialised at runtime in case of failure without the application crashing. While everything works fine even with high load i would like to know…
Atlantrix
  • 149
  • 1
  • 8
1
vote
2 answers

How to Design a Database Monitoring Application

I'm designing a database monitoring application. Basically, the database will be hosted in the cloud and record-level access to it will be provided via custom written clients for Windows, iOS, Android etc. The basic scenario can be implemented via…
tunafish24
  • 2,288
  • 6
  • 28
  • 47
1
vote
1 answer

Is it necessary to clean up the SocketAsyncEventArgs.Completed?

So I have an IOCP project with a SocketAsyncEventArgs pool that makes them re-usable and reduces the heavy allocation task of SocketAsyncEventArgs. I assume that when the SocketAsyncEventArgs.Completed event gets invoked, staying re-usable(not…
Dean Seo
  • 5,486
  • 3
  • 30
  • 49
1
vote
1 answer

post many wsasend on the same socket from multiple threads

(the question is copied from msdn forum) MSDN says this: If you are using I/O completion ports, be aware that the order of calls made to WSASend is also the order in which the buffers are populated. WSASend should not be called on the same…
maciekm
  • 257
  • 1
  • 5
  • 28
1
vote
2 answers

IOCP: If operation returns immediately with error, can I still receive completion notification?

If FILE_SKIP_COMPLETION_PORT_ON_SUCCESS is not enabled, then even if the operation completes immediately with success, I still get a completion notification on the completion port. I'd like to know if this is the case if it completes immediately…
Display Name
  • 2,323
  • 1
  • 26
  • 45
1
vote
2 answers

Performance benefit of multiple pending reads or multiple pending writes per individual TCP socket?

IOCP is great for many connections, but what I'm wondering is, is there a significant benefit to allowing multiple pending receives or multiple pending writes per individual TCP socket, or am I not really going to lose performance if I just allow…
Display Name
  • 2,323
  • 1
  • 26
  • 45
1
vote
2 answers

io completion ports issue with calling multiple wsarecv or wsasend per GetQueuedCompletionStatus

I have an application that should communicate with a socket(udp) and a device and I'm doing it with IOCP. The way its working is starting with sending and receiving some data via socket to a remote peer and then it starts to read and write to the…
madz
  • 1,803
  • 18
  • 45
1
vote
1 answer

How to handle multiple clients from one UDP Socket?

I'm dealing right now with an issue, where I don't know the right/best solution to. Consider the following example: Imagine you have one Socket, like this: SOCKET s = socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP); On this socket, which I will refer to as…
fludd
  • 53
  • 1
  • 6
1
vote
2 answers

WSABUF structure used in several wsasend

I am aware that i should provide each Wsasend/recv operation unique OVERLAPPED structure or buffer and keep them valid until GQCS notification. But i need a little clarification about WSABUF structure, should it be unique too, or i can reuse it like…
maciekm
  • 257
  • 1
  • 5
  • 28
1
vote
1 answer

SetFileCompletionNotificationModes() disrupts my event loop, and yours?

The new Windows API SetFileCompletionNotificationModes() with the flag FILE_SKIP_COMPLETION_PORT_ON_SUCCESS is very useful to optimize an I/O completion port loop, because you'll get less I/O completions for the same HANDLE. But it also disrupts the…
Marco Pagliaricci
  • 1,366
  • 17
  • 31
1
vote
2 answers

SetFileCompletionNotificationModes seems to not work properly

I'm using SetFileCompletionNotificationModes() API to optimize my I/O completion ports loops, but it seems to not work properly. Even if I set FILE_SKIP_COMPLETION_PORT_ON_SUCCESS for sockets and HANDLEs, an I/O port's completion callback is still…
Marco Pagliaricci
  • 1,366
  • 17
  • 31
1
vote
1 answer

Multiple I/O Completion Ports

Can I create multiple I/O Completion Ports in a single application? I mean, hold two or more CreateIoCompletionPort handles with their own CompletionKey's? My application has 2 IOCP Classes with their own client structures starting from the index 0.…
Victor Volpe
  • 101
  • 9
1
vote
1 answer

GQCS gets notification, when WSAsend returns 0?

Although I have read a lot about WSAsend (msdn), I still need some clarifications. Part of my code: int rc; rc=WSASend(Socket,....); if (rc==0) {....} else if ((rc == SOCKET_ERROR) && (WSA_IO_PENDING != (err = WSAGetLastError()))) …
maciekm
  • 257
  • 1
  • 5
  • 28
1
vote
1 answer

storage and management of overlapped structure in multithreaded IOCP server

Is it good idea to use LINKED LIST to store overlapped structure? my overlapped structure looks like this typedef struct _PER_IO_CONTEXT { WSAOVERLAPPED Overlapped; WSABUF wsabuf; .... some other per…
maciekm
  • 257
  • 1
  • 5
  • 28