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

IOCP server and send data with single wsasend

I work on IOCP Server in windows. And i have to send buffer to all connected socket. The buffer size is small - up to 10 bytes. When i get notification for each wsasend in GetQueuedCompletionStatus, is there guarantee that the buffer was sent in one…
maciekm
  • 257
  • 1
  • 5
  • 28
1
vote
5 answers

Optimizing an I/O bound Win32 application

I'm trying to optimizie an I/O bound C++ Win32 application. What it actually does is something very similar to recurse a folder and compute a cryptographic hash of every file it finds. It's a single threading application using memory mapped files,…
Simone Margaritelli
  • 4,584
  • 10
  • 45
  • 70
1
vote
1 answer

IOCP Socket, Not sure what to do next

I learned how to create sockets using the Windows Message Proc and switched on FD_CONNECT, FD_ACCEPT, FD_CLOSE, etc.. I used: WSAAsyncSelect(socket, WindowHandle, WM_SOCKET, FD_READ | FD_WRITE | FD_CONNECT | FD_CLOSE | FD_ACCEPT). This let me know…
Brandon
  • 22,723
  • 11
  • 93
  • 186
1
vote
1 answer

C# SocketAsyncEventArgs stops firing completed event

I have noticed a problem where the .Completed event of a SocketAsyncEventArgs seems to stop firing. The same SAEA can fire properly and be replaced in the pool several times, but eventually all instances will stop firing, and because the code to…
Carlos
  • 5,991
  • 6
  • 43
  • 82
1
vote
2 answers

WSAsend to all connected socket in multithreaded iocp server

I work on IOCP Server (Overlapped I/O , 4 threads, CreateIoCompletionPort, GetQueuedCompletionStatus, WSASend etc). I also created an auto-reset event and put the handle in the OVERLAPPED structure for each asynchronous I/O operations. And the…
maciekm
  • 257
  • 1
  • 5
  • 28
1
vote
1 answer

Completion ports (limits)

I have some questions about Completion ports: How many Completion ports could be opened at the same time per process? What pros and cons of separating ports by data type?
Edward83
  • 6,664
  • 14
  • 74
  • 102
1
vote
1 answer

IOCP and non-blocking IO

I have 3rd party library that uses non-blocking send, recv (in Windows), so I can use libevent (or libev) with select backend to event loop. Is there easy way to use IOCP backend (libevent2, libuv)? Because in different manuals write, that i must…
Dark Hydra
  • 265
  • 6
  • 21
1
vote
2 answers

IOCP - post overlapped or read packet?

I'm supposed to read the first 9 bytes which should include the protocol and incoming size of the data packet. When the completion port returns with the 9 bytes which is better to do? (performance / good practice or aesthetics wise) Post another…
user1255454
  • 669
  • 1
  • 8
  • 18
1
vote
0 answers

I/O completion ports closing a handle cause reads to complete

I have iocp running and working (mostly) -- but should calling CloseHandle() on a handle cause it to complete? e.g., I've called ReadFile() and it's now waiting for input to read. At another point I'm calling CloseHandle() from another thread in the…
David Hoyt
  • 11
  • 2
1
vote
1 answer

What if lpCompletionRoutine of WSASend is specified in IOCP model?

The MSDN page for WriteFileEx says that it can not be used in IOCP model because it has an argument to specify the completion routine. If the file handle has been associated with an I/O completion port, then WriteFileEx will fail. However, WSASend…
xmllmx
  • 39,765
  • 26
  • 162
  • 323
1
vote
1 answer

windows xp vs 7, what's difference UDP accepting rules

When I get a UDP packet (especially, rtp), I have a different phenomenon. It happens by difference of windows version at windows 7 professional K. UDP packet coming normally without open udp port on my pc (I saw it on wireshark) but, at windows XP…
Arena Son
  • 95
  • 1
  • 8
1
vote
0 answers

WinSock2 IOCP WSARecv GetQueuedCompletionStatus: data (automatically) ends up in char*buffer, not WSABUF.buf...why?

While debugging, when WSARecv is called, I supply the function with the address of the PerIoData->WSABUF structure. This should assign the sent data to the WSABUF.buf char* array, which it seems to. When The worker thread loops back to the waiting…
hwill
  • 29
  • 7
1
vote
2 answers

C++ IOCP server container information

I have been passing a few ideas around in my head about how to actually contain large amounts of connections using an IO type of architecture while maintaining KISS. Through examples on the web, it seems like most use a double/single linked list…
User
  • 659
  • 2
  • 12
  • 29
1
vote
1 answer

Can I use std::shared_ptr to wrap per I/O data in IOCP?

I'm working on a client application that uses IOCP. My per I/O data class is derived from WSAOVERLAPPED: class IoRequest : public WSAOVERLAPPED { ... }; And when performing asynchronous I/O operations, I use it like this: { // WSASend - this is…
jpen
  • 2,129
  • 5
  • 32
  • 56
1
vote
1 answer

Placing calling thread in an alertable wait state

My main thread creates multiple I/O worker threads. I then initiate an I/O request from my main thread by doing: { ... IoRequest *pIoRequest = new IoRequest(m_socket); pIoRequest->SetBuffer(vecCommandData); // vector of BYTEs …
jpen
  • 2,129
  • 5
  • 32
  • 56