Search code examples
socketswinapiselectiocpreactor-pattern

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


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 writable (reactor).

Something similar to epoll, kqueue, /dev/poll ?

Is there such API in Win32? If so where can I find a manual on it?

** Clarification:** I need select like api for sockets that is as scalable as IOCP, or I'm looking for a way to use IOCP in reactor like operations.

Even more clarification: IOCP allows you to receive an notification on completion of given operation. For example:

WSARecv(buffer,...); // start reading
WSAWaitForMultipleEvents(...); // wait when read is done

So I get notication after operation is done -- proctor style of operations.

What I need is something like that:

WSARecv( NOTHING ); // start waiting for readability (not actual read)
WSAWaitForMultipleEvents(...); // wait until read would not block
// Now WSARecv would not block
WSARecv(buffer,...); // now actual non-blocking read

How can I do this?


Solution

  • Not possible.

    I've checked Boost.Asio sources that do have reactor style operations and use IOCP. For all reactor style operations separate thread with select is used instead of IOCP.