Skip to content

Add IOCP context and Windows platform support#51

Merged
dietmarkuehl merged 1 commit intobemanproject:mainfrom
sgerbino:feature/iocp
Apr 3, 2026
Merged

Add IOCP context and Windows platform support#51
dietmarkuehl merged 1 commit intobemanproject:mainfrom
sgerbino:feature/iocp

Conversation

@sgerbino
Copy link
Copy Markdown
Contributor

@sgerbino sgerbino commented Apr 1, 2026

Implement iocp_context using Windows I/O Completion Ports as the async backend, alongside a platform abstraction header that provides POSIX compatibility types (iovec, msghdr, socklen_t) on Windows and the standard networking headers on POSIX.

Key changes:

  • iocp_context: AcceptEx, ConnectEx, WSARecv/WSASend, timer support via sorted_list, CancelIoEx cancellation, deferred socket cleanup
  • platform.hpp: cross-platform header abstraction
  • Zero per-operation allocations: per-socket OVERLAPPED storage via unique_ptr for address stability
  • Port existing headers to use platform.hpp instead of raw POSIX includes
  • Make native_handle_type platform-conditional (uintptr_t on Windows)
  • Guard SIGPIPE signal handling for Windows compatibility
  • CMake WIN32 block links ws2_32/mswsock and defines BEMAN_NET_USE_IOCP
  • Re-enable examples on Windows

Implement iocp_context using Windows I/O Completion Ports as the async
backend, alongside a platform abstraction header that provides POSIX
compatibility types (iovec, msghdr, socklen_t) on Windows and the
standard networking headers on POSIX.

Key changes:
- iocp_context: AcceptEx, ConnectEx, WSARecv/WSASend, timer support
  via sorted_list, CancelIoEx cancellation, deferred socket cleanup
- platform.hpp: cross-platform header abstraction
- Zero per-operation allocations: per-socket OVERLAPPED storage via
  unique_ptr for address stability
- Port existing headers to use platform.hpp instead of raw POSIX includes
- Make native_handle_type platform-conditional (uintptr_t on Windows)
- Guard SIGPIPE signal handling for Windows compatibility
- CMake WIN32 block links ws2_32/mswsock and defines BEMAN_NET_USE_IOCP
- Re-enable examples on Windows
Copy link
Copy Markdown
Member

@dietmarkuehl dietmarkuehl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I don't have much experience using the Windows API, though.

@dietmarkuehl dietmarkuehl merged commit 50304a7 into bemanproject:main Apr 3, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants