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

ConnectEx with IOCP problem

I've made a simple dummy server/dummy client program using IOCP for some testing/profiling purpose. (And I also wanted to note that I'm new to asynchronous network programming) It looks like the server works well with original client, but when the…
summerlight
  • 882
  • 7
  • 16
1
vote
2 answers

WSASend() with more than one buffer - could complete incomplete?

Say I post the following WSASend call (Windows I/O completion ports without callback functions): void send_data() { WSABUF wsaBuff[2]; wsaBuff[0].len = 20; wsaBuff[1].len = 25; WSASend(sock, &wsaBuff[0], 2, ......); } When I get the…
Poni
  • 11,061
  • 25
  • 80
  • 121
1
vote
0 answers

libEvent on Windows2008 server 64 or on ubuntu linux 13.0 server?

Currently I'm developing a client-server system on windows2008 server R2 64, a server will comsume 2 or 3 clients, each client will send seperate binary message with 1.6k each to the server by 20Pc/second, that is, every 50ms the client will send a…
Benz
  • 11
  • 2
1
vote
1 answer

How Do I Code To Prevent Intermittent net::ERR_EMPTY_RESPONSE from Chrome Browser

The bug I'm seeing is intermittent. First, the codebase. The repo is here Where I think the bug is coming from is here I think GetQueuedCompletionStatus() gets blocked because of thread synch issues? Debugging the code, I made a screenshot of it,…
benG
  • 82
  • 9
1
vote
1 answer

IOCP or TASK communication between server-client

I need to implement server-client communications which must keep a lot of connections (1k-3k). What better to choose, IOCP or Task Async?
Kernighan
  • 41
  • 1
  • 6
1
vote
1 answer

Windows WriteFileGather function set last error as ERROR_INVALID_PARAMETER

Example code to reproduce my problem: #include #include int main() { using namespace std; HANDLE hdl = CreateFile("test.file", GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, …
Acer
  • 419
  • 4
  • 13
1
vote
1 answer

Should WSASocket() be used with IOCP?

I know that it is recommended to use WSAAccept() instead of accept() when creating an IOCP application. But I am not sure if WSASocket() belongs to the Overlapped I/O functions, or is it just another Winsock function?
user4344762
1
vote
1 answer

How to know when the socket has received a FIN packet when using WSARecv() and IOCP?

When using blocking sockets and the recv() function, when the socket has received a FIN packet, recv() will return 0. However, how to know when the socket has received a FIN packet when using WSARecv() and IOCP? I think that the lpNumberOfBytesRecvd…
user4572253
1
vote
1 answer

How to create multiple threads for the completion port?

Multiple threads can dequeue completion packets from a single completion port using the GetQueuedCompletionStatus() function. Is there a special function that creates these threads? Or I simply use for example CreateThread() or _beginthreadex() and…
Tom
  • 1,344
  • 9
  • 27
1
vote
2 answers

Should I handle the fact that WSASend() may not send all data?

I have found out that WSASend() may not send all of the data, for example if I asked it to send 800 bytes, it may only send 600 bytes. Now my question is: are the situations where this can happen are extremely rare that I should not bother handling…
user4592590
1
vote
1 answer

Should I handle the error of WSARecv() in two places?

When I call WSARecv() (or another Overlapped IO function), I could get an error immediately or I can get an error when I call GetQueuedCompletionStatus() to dequeue a completion packet. So is it accurate to assume that I must handle the error…
user4592590
1
vote
3 answers

What is the purpose of the OVERLAPPED structure when using IOCP?

I do not fully understand what is the purpose of the OVERLAPPED structure, is it used for the advanced stuff? If I want to receive data for example, I just create an instance of WSABUF structure and pass it to WSARecv(), and when the read operation…
John
  • 1,049
  • 1
  • 14
  • 34
1
vote
1 answer

Can anyone explain to me this IOCP diagram?

In the book "WinSock Programming Fundamental: A Compilation", there is this diagram for IOCP: I understand that the completion notifications arrive at the completion port, and that the four queued threads call GetQueuedCompletionStatus() to get a…
user4592590
1
vote
2 answers

Does IOCP creates its own threads?

I am learning about IOCP, and according to this article: To begin using completion ports we need to create a Completion Port which in turn creates a number of concurrent threads (threads that exist with the Completion Port - Not to be confused…
user4344762
1
vote
2 answers

IO Completion Ports and socket WSARecv()

I am trying to understand how IOCP works with sockets. I need to understand if this is how they work: I create a completion port, which is nothing but a queue that will receive notifications when some operation completes, and then I associate my…
user4582812
  • 591
  • 1
  • 4
  • 16