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
0
votes
1 answer

iocp error, cannot receive message sometimes

iocp code is below: void xIocpWorkThread::Execute(LPVOID lpParam) { DWORD dwNumberOfBytes = 0; ULONG_PTR ulCompletionKey = 0; IOCP_UNIT * pIocpunit = 0; DWORD last_err = 0; DWORD listener_addr = 0; DWORD listener_sock =…
lcabcdefg
  • 1
  • 1
0
votes
1 answer

Queueuserworkitem vs TrySubmitThreadpoolCallback

Main Question: What is the difference between QueueUserWorkItem and TrySubmitThreadpoolCallback given that they both queue a work item to the Thread Pool TrySubmitThreadpoolCallback This function adds a work item to the thread pool's queue (by…
Lucas Paixão
  • 862
  • 5
  • 11
0
votes
2 answers

Why we need `CreateThreadpoolIo` and `StartThreadpoolIo` for IOCP?

I'm trying to use IOCP relying on Windows API CreateThreadpoolIo and StartThreadpoolIo, but I found the thread pool is just to make the code behind the IO completed parallel. The async IO submit operations are also execute sequentially in the main…
LauZyHou
  • 137
  • 1
  • 2
  • 11
0
votes
0 answers

How to bind multi file handle to the IOCP thread pool created by CreateThreadpoolIo?

I'm trying to use CreateThreadpoolIo for R/W on multi file. I found CreateThreadpoolIo can only pass one file handle. How to bind multi file handle on the thread pool? And how could I know how many threads will be use in the thread pool? Not…
LauZyHou
  • 137
  • 1
  • 2
  • 11
0
votes
0 answers

IOCP when read is busy?

while I am writing some IOCP server-client codes, I saw misc behavior in IOCP. The scenario goes here, Register Socket to IOCP Recv event catched by GetQueuedCompletionStatus while (!mExitFlag) { bool bSuccess =…
Y.frank
  • 56
  • 4
0
votes
0 answers

Where does pIOContextForward member set to not NULL value?

I am trying to use this Windows IOCP sample code as a starting point in my own IOCP server development. There is a structure _PER_IO_CONTEXT in IocpServer.h. // // data to be associated for every I/O operation on a socket // typedef struct…
anton.mo
  • 103
  • 1
  • 11
0
votes
1 answer

I don't know why my IOCP's numberOfConcurrentThreads argument doesn't work

I have read a material below and tested some code. Does IOCP creates its own threads? My codes are as below: #include #include #include #include #include #include #include…
DoyoHntr
  • 87
  • 5
0
votes
0 answers

How to use IOCP when no device or port/file is involved? I just want to use it for thread pool management

I have one confusion relating to IOCP (among so many others) as I am fairly new to multi-threaded programming. Can we not use IOCP without having to associate them with a device like a file/port/namedpipe etc.? What I really want to do is to build a…
Ngage
  • 1
  • 1
0
votes
1 answer

GetQueuedCompletionStatus - How to read clients messages without any socket struct

I'm trying to learn IOCP with C in Windows. The idea is to have a non-blocking server with threads that handle client messages. I understand by now how to accept clients, etc. But I still don't understand how to read each client's messages from…
0
votes
4 answers

I/O Completion Port, How to free Per Socket Context and Per I/O Context?

I'm using IOCP on UDP socket, and the UDP socket may be closed in another thread. So, how can I free Per Socket Context and Per I/O Context which associated with SOCKET safely? When I close the socket, there will still be un-completed I/O request in…
dragonfly
  • 443
  • 2
  • 5
  • 13
0
votes
1 answer

IO Completion Ports and WSASend

Sorry in advance, but please explain, how to use IOCP with WSASend - for example, to send a simple message to the server and receive a response from it. I am doing this: Create completion port Create threads for the completion port I create a…
Optimus1
  • 444
  • 2
  • 13
0
votes
0 answers

Windows IOCP socket programming crash in windows 10 & 2012

I am trying to help one of my customer to migrate a very old vc++ program which works on Windows 2003 as a win32 service to x64. It was compiled with VC 2005. I have migrated to VC 2019 with windows SDK 10 & Windows 10. There were few minor issues…
0
votes
3 answers

Is Node.js production-ready on Windows?

In the new 0.5.1 branch, there is an official Windows executable of Node.js. The Linux version of Node.js uses established libraries such as v8, libev, libeio. Since libev and libeio is for *NIX platforms; is the Windows port of Node.js ready for…
Jeff
  • 14,365
  • 8
  • 30
  • 30
0
votes
0 answers

Is there a user space equivalent of NtSetInformationFile?

I want to change the completion key for a handle that has been added to an I/O completion port. There are multiple answers like this that state that it can be done via NtSetInformationFile, but is there a user space equivalent for that? I am not…
Rudolfs Bundulis
  • 11,636
  • 6
  • 33
  • 71
0
votes
1 answer

How to make asynchronous read of a file with IOCP?

I have faced an implementation problem. I am puzzled on how to implement IOCP. I have read a lot on the Internet about it, but still missing one step. So far what I have learnt is as follows: In order to use IOCP: on an init…
user
  • 95
  • 1
  • 9