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

How to properly close worker threads created for using IOCP

Here is a code snippet from Network Programming for Microsoft Windows: ... // Determine how many processors are on the system. GetSystemInfo(&SystemInfo); // Create worker threads based on the number of // processors available on the system. For…
jpen
  • 2,129
  • 5
  • 32
  • 56
1
vote
1 answer

C++ CreateIoCompletionPort on new socket

EDIT: I am guessing the problem is I have to associate the OVERLAPPED or WSAOVERLAPPED in the container with my completion port. Is that correct? I can get IO completions when someone connects to my server. I then use CreateIoCompletionPort on the…
User
  • 659
  • 2
  • 12
  • 29
1
vote
1 answer

some OVERLAPS using WSASend not returning in a timely manner using GetQueuedCompletionStatus?

Background: I'm using CreateIoCompletionPort, WSASend/Recv, and GetQueuedCompletionStatus to do overlapped socket io on my server. For flow control, when sending to the client, I only allow several WSASend() to be called when all pending OVERLAPs…
Geoffrey
1
vote
2 answers

Use of per IO data with IOCP based client

I'm trying to create an IOCP TCP client and my code looks as follows: TCPClient.h: #pragma once typedef struct { WSAOVERLAPPED Overlapped; SOCKET Socket; WSABUF wsaBuf; char Buffer[1024]; DWORD Flags; DWORD BytesSent; …
jpen
  • 2,129
  • 5
  • 32
  • 56
1
vote
1 answer

Associate several files to the same io completion port, while keeping file stream order c#

I need to write objects, sent to me from another process, to several files on my disk. Each object comes with fileID (the name of file to be written in to) and chunks of data. I would like to use IO completion port (IOCP) in order to optimize the…
choppy
  • 739
  • 1
  • 12
  • 22
1
vote
1 answer

How to get client real ip-address and port using IOCP?

I need to take ip-address and port of clients in server. Server written on C++ using IOCP, so I don't accept clients, I create new socket and then accept (AcceptEx) client on this ready socket. And because of it struct sockaddr_in is not…
Alexander
  • 275
  • 2
  • 4
  • 13
0
votes
1 answer

How to implement ConnectEx, AcceptEx in Winsock SPI

These are Microsoft specific extensions and I wonder if it is possible to implement them in third-party drivers. They are both needed to implement pure IOCP client and server code. The Function Extension Mechanism in the SPI page is a little thin on…
user172783
0
votes
0 answers

.NET 6 long busy wait on IO operations instantly completes when memory dump is taken

The program uses the Faster library to store some kv and spilling to disk. The code is trying to wait for Faster to complete any pending operations after writing all the entries with a timeout. It invokes CompletePending and busy waits with…
bearwithme
  • 55
  • 7
0
votes
1 answer

Multiple immediate number of WSASend calls and the data sending order

As you know, WSASend-completion-WSASend-...(repeat) guarantees sending data in order. However, I heard that WSASend-WSASend-WSASend-completion-completion-completion ALSO GUARANTEES sending data in order, although the order of completion does not. Is…
Hyunjik Bae
  • 2,721
  • 2
  • 22
  • 32
0
votes
1 answer

WSARecvFrom unclear return behavior with IOCP (UDP)

I am using winapi function WSARecvFrom to receive UDP data on a socket, I am using overlapped IO with IOCP ports. In the documentation its stated: If no error occurs and the receive operation has completed immediately, WSARecvFrom returns…
xXTurner
  • 61
  • 9
0
votes
0 answers

Why does the callback function in WSARecv() not work?

I'm having a hard time implementing the client to connect with the IOCP server in an asynchronous manner. Sending packets from the client to the server using WSASend worked normally. Connection and Packet send Code - Client SOCKADDR_IN…
MeoH
  • 13
  • 4
0
votes
2 answers

A question on IOCP

If I want to use completion port to get information from different thread , how can I design the structure of the program?How about the one below? If I want to use a global function ,how can I set the mutexes ? Main(){ for i in range…
user53670
0
votes
0 answers

LIFO ordering of return from GetQueuedCompletionStatus

Windows IOCP documentation states this with regard to GetQueuedCompletionStatus: Threads that block their execution on an I/O completion port are released in last-in-first-out (LIFO) order, and the next completion packet is pulled from the I/O…
Agnel Kurian
  • 57,975
  • 43
  • 146
  • 217
0
votes
0 answers

IOCP Threads and GetQueuedCompletionStatus

Been trying to wrap my head around windows IOCP and have run into a few issues as many other people seem to be doing so. So far what I'm trying to do is run a TCP IOCP server, which creates 3 accept sockets and has a thread for each waiting on a…
MkJAS
  • 1
  • 1
0
votes
0 answers

How to bind multi IOCP handle to a single file handle to split read / write request?

I want to split read write request to a single file. And I still want to leverage on IOCP to get best performance. In detail. I want to bind a file handle F to two IOCP queue. One for read names R, one for write names W. For R, I will use it in…
LauZyHou
  • 137
  • 1
  • 2
  • 11