Yet another wrapper for poll, epoll, kqueue, etc.
A portable library for async socket I/O and some helpful event loop features.
-
The core "wait object" interface is in
pollster.h
. This provides:- Socket read or write readiness polling.
- Auto-reset events, similar to Win32
CreateEvent()
or Linuxeventfd(2)
. - Timers.
-
Atop this are some "simple" APIs for convenient asynchronous socket programming, in
sockapi.h
. -
TLS/SSL support for both clients and servers can be added via
ssl.h
.
Building happens via the makefiles submodule.
$ git submodule update --init
$ make # or "gmake" on some platforms, like BSD
On Unix, the project builds with g++ 8.0 or higher (7 and earlier won't work!) or clang++.
On Windows, GNU make, nasm and msysgit should be on PATH, and the project is typically tested with VS2015 with Windows SDK 10586.
- Linux: epoll, async DNS via getaddrinfo_a()
- FreeBSD, OpenBSD, NetBSD, macOS: kqueue
- Solaris: port_create, /dev/poll
- Windows
- Notably, this does not use I/O completion ports, but creates a separate thread for every 63 handles to call WaitForMultipleObjects(). So the Windows backend, while working, is not as good as it could be.
There is also a generic poll(2) based backend, if none of the more platform specific methods are available.
TLS support use:
- Windows: SChannel
- macOS: SecureTransport
- OpenSSL/LibreSSL etc., tested regularly on FreeBSD, OpenBSD, Linux.