P\Invoke example which implements a managed adapter to TCP Ws2 sockets. It exposes a part of the available API, but it is enough to create an asynchronous client or server which supports only TCP.
Uses the following WinAPI components:
- IOCP (I/O Completion Ports) for asynchronous I/O operations.
- OS-managed thread pool which listens on IOCP and dispatches the completion callbacks.
- WS2 sockets for network communication.
Callback-based asynchronous model is adapted to the Task-based asynchronous model which is used in C#. Additionally, implements a scoping mechanism for deterministic resource management. For more information, look into comments littered across the codebase.