iocp

IOCP in custom thread pool

I'm currently searching the internet for a custom thread pool implementation. I found an implementation which uses IOCP's. I'm wondering what the benefit is, of using them? Do they provide work stealing, or something like that, I could really find an answer... ...

IOCP, Cross platform libraries?

I've recently bumped into something called IOCP on the windows platform, to be more precise: Input/Output Control Ports. This seems to be the most efficient way to code your server software when it needs to hold thousands of users concurrently. (Correct me if I'm wrong, but thread-per-socket, polling, and asynchronous callbacks (thread o...

Mono and C# IOCP: Is it a good idea?

Hi, I'm porting a c++ app to c# that uses IOCP on it's server. Can mono handle IOCP as well as windows? will i get comparable performance to c++ or i should try something else? thanks ...

Serial Comms via IOCP

Is it possible to use IO Completion Ports for Serial I/O? According to Windows via C/C++ it is alluded to that it is possible, and does give an example of using IOCP with physical files showing work with CreateFile, ReadFile, WriteFile, etc. However can this actually work with serial comms - has anyone got it working? I can't find any e...

I/O Completion Port, How to free Per Socket Context and Per I/O Context?

I'm using IOCP on UDP socket, and the UDP socket may be closed in another thread. So, how can I free Per Socket Context and Per I/O Context which associated with SOCKET safely? When I close the socket, there will still be un-completed I/O request in kernel queue. If I free context just when socket closed, the GetQueueCompletionStatus m...

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 NumOfThreads{ CreateIoCompletionPort() CreatThread(ThreadFun) } } ThreadFun(){ Whil...

A question about windows iocp.

When I write a program about IO completion port in Windows Vista, the first sample didn't work and the GetQueuedCompletionStatus() can not get any OVERLAPPED structures. So I put the OVERLAPPED structure in global scope,and it works amazingly. Why is that? CODE1: int main() { OVERLAPPED o; .. CreateIoCompletionPort(....);...

Is this program running Asynchronous or synchrounous?

When I run this program OVERLAPPED o; int main() { .. CreateIoCompletionPort(....); for (int i = 0; i<10; i++) { WriteFile(..,&o); OVERLAPPED* po; GetQueuedCompletionStatus(..,&po); } } it seems that the WriteFile didn't return until the writing job is done. At the same time , GetQueuedC...

Overlapped I/O: How to wake a thread on a completion port event or a normal event?

I want to use a thread pool to both initiate/cancel overlapped read operations -- using ReadFile() and CancelIo() respectively -- as well as handling any completion port events when read operations complete. Any thread can initiate a read operation Any thread can handle a read-complete event Only the thread that initiated a read may ca...

Delphi TClientSocket replacement using winsock2 and IOCP?

Is there such a thing? It needs to be asynchronous (no Indy). ...

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 have popped off the IOCP. Problem: Recently, there are occassions when the OVERLAPs do ...

IO completion port key confusion

I'm writing an IO completion port based server (source code here) using the Windows DLL API in Python using the ctypes module. But this is a pretty direct usage of the API and this question is directed at those who have a knowledge of IOCP, not Python. As I understand the documentation for CreateIoCompletionPort, you specify your "user...

Using SslStream with IOCP

I have written a TCP server using the Socket class's asynchronous/IOCP methods, BeginSend()/BeginRead()/etc. I would like to add SSL capability using SslStream, but from the interface it looks like Socket and SslStream are not intended to work together, in particular because I'm not using Streams at all and SslStream appears to depend o...

Async operations with I/O Completion Ports return 0 bytes transferred

Asynchronous operations with I/O Completion Ports return 0 bytes transferred, although the I/O operations work as expected (my read buffers become full). BYTE buffer[1024] = {0}; OVERLAPPED o = {0}; HANDLE file = CreateFile( _T("hello.txt"), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED...

IO Completion ports: How does WSARecv() work?

Hi,I want to write a server using a pool of worker threads and an IO completion port. The server should processes and forwards messages between multiple clients. The 'per client' data is in a class ClientContext. Data between instances of this class are exchanged using the worker threads. I think this is a typical scenario. However, I h...

Is there a I/O completion port based component for Delphi?

I am aware of Indy, ICS, Synapse and Clever InetSuite, none of which support IOCP. Is there anything else out there? Edit: I found iocpclasses , It's written in Delphi5. Better than nothing I suppose. ...

Is is possible to use IOCP (or other API) in Reactor-style operations?

Hello, Is there any scalable Win32 API (like IOCP not like select) that gives you reactor style operations on sockets? AFAIK IOCP allows you to receive notification on completed operations like data read or written (proactor) but I'm looking for reactor style of operations: I need to get notification when the socket is readable or writa...

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 associate the socket with IOCP and finally call WSARecv() to read the data. Some data is i...

Linux and I/O completion ports?

Using winsock, you can configure sockets or seperate I/O operations to "overlap". This means that calls to perform I/O are returned immediately, while the actual operations are completed asynchronously by separate worker threads. Winsock also provides "completion ports". From what I understand, a completion port acts as a multiplexer of...

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 std::exception("Failed to create socket."); } if (WSAConnectByName(m_socket, L"server.com", L"80"...