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

WSASend speed and optimization

I'm implementing a simplified, static web server inspired by this example: https://github.com/young2code/IOCP/blob/master/IOCP%20-%20NewThreadPool/Server/Server.cpp The problem is that WSASend can not exceed 2 Mbit/s on a LAN or on the same machine.…
Olivier
  • 73
  • 7
0
votes
1 answer

Add OpenSSL Support in IOCP Client application

I have developed IOCP Client application which send message to server. Now I want to add SSL Support in it for Connecting SSL enabled Server application using OpenSSL. I have initialize SSL using /* Load encryption & hashing algorithms for the SSL…
0
votes
1 answer

Detecting named pipe disconnects with I/O completion

I have a question about the correct approach for detecting client disconnects using named pipes with I/O completion ports. We have a server that creates child processes with stdin/stdout redirected to named pipes. The pipes are opened OVERLAPPED. …
user590028
  • 11,364
  • 3
  • 40
  • 57
0
votes
0 answers

SendAsync, called in IOCP callback overtakes an earlier SendAsync call that lead to the callback

In a scenario where a socket mostly sends data and that looks basically like the following code snippet, I sometimes get reentrancy in CompletedHandler, where both calls made by IOCP framework, and the second callback, which is the result of…
Evgeniy Berezovsky
  • 18,571
  • 13
  • 82
  • 156
0
votes
1 answer

How to set up a thread pool for an IOCP server with connections that may perform blocking operations

I'm currently working on a server application that's written in the proactor style, using select() + a dynamically sized thread pool (there's a simple mechanism based on keeping track of idle worker threads). I need to modify it to use IOCP instead…
Bwmat
  • 4,314
  • 3
  • 27
  • 42
0
votes
1 answer

Using iocp in a job pool

When using iocp in a job/task pool to provide fast worker wake ups what is the best way to minimise the overhead of signalling the port - ie not having to do it every queue operation? void Worker() { while(1) { for(int spin = 0;…
iam
  • 1,623
  • 1
  • 14
  • 28
0
votes
0 answers

IO completion port (object relation)

I begin learning about IOCP, I see some object: Io completion port, thread pool, thread, completion packet. Please show me relation of them. Many thanks.
0
votes
1 answer

Pass a direct value to CreateIoCompletionPort()'s CompletionKey parameter

When using CreateIoCompletionPort() to associate a SOCKET with a completion port, can I pass a direct value (i.e. not a pointer) to the CompletionKey parameter, or should I only pass a pointer? What I want to do is to pass the SOCKET value.
user4344762
0
votes
2 answers

Why this code doesn't work when "cout"s are commented?

I'm writing a server for an online game based on IOCP, and the core codes handling game message is something like below: CMessage ret; int now_roomnum = recv_msg->para1; int now_playernum = recv_msg->para2; /*if(true) { cout<<"Received Game…
DarkZero
  • 2,259
  • 3
  • 25
  • 36
0
votes
2 answers

Multithreaded IOCP Client Issue

I am writing a multithreaded client that uses an IO Completion Port. I create and connect the socket that has the WSA_FLAG_OVERLAPPED attribute set. if ((m_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) { throw…
Carl
  • 3
  • 2
0
votes
1 answer

Why this online game go out of sync after some time?

I'm making a simple online game and I'm suffering from out-of-sync issues. The server is implemented with IOCP, and since the game will be held almost always in LAN, the delay is relatively small. The core algorithm of network connecting can be…
DarkZero
  • 2,259
  • 3
  • 25
  • 36
0
votes
3 answers

What IO operations causes completion packets to be sent to the completion port when using sockets?

In IOCP, when starting an IO operation such as WSARecv(), a completion packet will be sent to the completion port when the IO operation completes. What I want to know is what IO operations causes completion packets to be sent to the completion port…
user4182981
0
votes
1 answer

Should I make simultaneous WSASend() calls?

I know that in order to call WSASend() simultaneously, I need to provide for each call a unique WSAOVERLAPPED and WSABUF instances. But this means that I have to keep track of these instances for each call, which will complicate things. I think it…
John
  • 1,049
  • 1
  • 14
  • 34
0
votes
2 answers

How to initialize WSAOVERLAPPED when using IOCP?

I am not sure how to initialize WSAOVERLAPPED when using IOCP. I don't think that I need to initialize it at all, I only set WSAOVERLAPPED.hEvent to NULL (not sure if this is necessary either). Is this code correct: // Send data char…
user4592590
0
votes
1 answer

How many threads I should create for IOCP?

I have read that the ideal number to pass to the NumberOfConcurrentThreads parameter of the CreateIoCompletionPort() function is 0, which will translate to the number of cores. However, how many threads I should actually create that waits on the…
Tom
  • 1,344
  • 9
  • 27