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

Server memory management

I'm developing server on Windows. My server uses IOCP sockets and a database. Usual situation is that user connects and stays connected for a long time. While connected user can request some data from server. Usually request is associated with db…
Mike Jackson
  • 183
  • 1
  • 12
0
votes
2 answers

Does WSASend() in blocking mode causes a notification packet to be placed in the completion port?

I can use WSASend() in blocking mode if I do not supply an overlapped structure or a completion routine when I call it. But my question is: does a blocking WSASend() call causes a notification packet to be placed in the completion port?
John
  • 1,049
  • 1
  • 14
  • 34
0
votes
1 answer

How to simulate a blocking send() using WSASend() and IOCP?

Edit: This question is not necessary, as the WSASend() function can inherently be used in a blocking mode, even if the socket has the overlapped attribute and is associated with a completion port. To use it in a blocking mode: just don't supply an…
John
  • 1,049
  • 1
  • 14
  • 34
0
votes
1 answer

How to know if a completion packet is for WSASend() or WSARecv() or AcceptEx()?

When I call WSASend() or WSARecv() or AcceptEx(), a completion packet will be placed in the completion port and I can dequeue it using GetQueuedCompletionStatus(). But how can I know what operation this completion packet represents?
user4592590
0
votes
2 answers

How to send a file using IOCP?

When using blocking sockets, all I had to do to send a file was to open the file and loop through it and send it in chunks. But I find sending a file using overlapped sockets to be more challenging. I can think of the following approach to do it: I…
John
  • 1,049
  • 1
  • 14
  • 34
0
votes
2 answers

IOCP not getting triggered

I have writen an IOCP program and I am testing it through VPN. It was all working OK, but then the server disconnected and the client GetQueuedCompletionStatus didn't trigger an exception. I waited for one day,cbut it didn't get better. When I…
0
votes
1 answer

Use thread local store lua_State

I need to use Lua in IOCP, and use Thread local Storage to store lua_State *. I should use lua_close() destroy the lua_State before the thread destroyed, but the work thread is created by IOCP. The question is when is the right time to call…
bywayboy
  • 3
  • 4
0
votes
0 answers

IOCP GetQueuedCompletionStatus returns with null lpOverlapped

I'm trying to write IOCP server with C# using Win32API, imported from kernel32.dll and ws2_32.dll. The problem occurs within worker threads. If I make frequent request to the server, it dies within a ten seconds. (break the loop!) Detailed situation…
Jongbin Park
  • 659
  • 6
  • 14
0
votes
1 answer

C++ Windows IOCP - HTTP POST data missing

I have written a very simple IOCP HTTP server that works for the GET verb, but not POST. I create a socket and a listen thread in which accept() is waiting for a connection. When a client connects I call ioctlsocket() to unblock the socket then I…
Mike Trader
  • 8,564
  • 13
  • 55
  • 66
0
votes
0 answers

GetQueuedCompletionStatus returns with bad information

I'm writing a multicast producer and multicast consumer applications using IOCP. My producer app is multi-threaded and publishes to multiple multicast channels. Each channel is published on its own thread, so I'm certain there are no…
Tim Brauer
  • 35
  • 5
0
votes
4 answers

Sending list of connected users to newly connected user in multithreaded iocp server

I need some advice how to send properly doubly linked list of connected users. Some basic information about my code and my approach so far: I keep information about all connected users in doubly linked list, which is shared among threads. I store…
maciekm
  • 257
  • 1
  • 5
  • 28
0
votes
1 answer

libevent-2.1.4-alpha, server can't receive connection event when initialized with IOCP enabled

I use libevent-2.1.4-alpha, server can't receive connection event when initialized with IOCP enabled. int main(int argc, char **argv) { struct event_config *evcfg; struct event_base *base; struct evconnlistener *listener; struct sockaddr_in…
jie xu
  • 1
  • 1
0
votes
2 answers

C# SocketAsyncEventArgs and network glitches

I've implemented async sockets using SAEA in the canonical way: Have a pool of SAEAs ready for operations, keeping references so the GC doesn't have to move the memory Replace the SAEAs when operations finish. I've discovered an issue to do with…
Carlos
  • 5,991
  • 6
  • 43
  • 82
0
votes
1 answer

Detecting if CancelIoEx canceled synchronously

I'm adding per-async-operation timeouts to my IOCP-based networking stuff, so I can have a similar interface in C++ as Java's NIO.2 uses. I've implemented this with a priority queue of timeouts that supports random-access removes (so that when an…
Display Name
  • 2,323
  • 1
  • 26
  • 45
0
votes
0 answers

IOCP close socket and delete per io related buffer

Trying to stop IOCP worker thread and close socket and related per io datums This is based on reference counting and when ref count reach 0, close socket and delete buffers. Below is skeleton of IOCP worker thread. When I want to stop IO , call…
Mark Yang
  • 226
  • 3
  • 16