libnbio

written once, used forever.

Description

libnbio is a C library that can function as the main event loop of a non-blocking-I/O based application. It is meant to decrease the hassle, while increasing sanity, of such code. File descriptors are added and removed by the parent application, and callbacks are called for pending incoming data or when data has been written. The library can function as a simple wrapper for poll(), or it can go further and use a simple data buffering scheme (vectors). (Vector and raw modes can be enabled or disabled for individual descriptors, and enabled/disabled independently in read and write directions.) Additionally, the library can be used as a cross-platform network socket I/O abstraction layer, as it transparently supports traditional UNIX sockets (using poll()) as well as FreeBSD's kqueue and Win32's WSA/winsock (giving the latter a UNIX-like API as well).

There is no actual documentation, but a small (but not terribly simple) sample application is included in the package.

This library has been used in several commercial applications and a few Free Software projects (which I contend are free even though no one but me and my friends have copies of them). However, from now on, only the releases from this page (and packages of this exact tree, of course) can be considered canonical, even if I've said random things to the contrary in the past.

libnbio is released under the LGPL license, as included in the distribution. Though you don't have to, it'd be nice if you let me know if you use it. But this seems inevitable since you'll probably need to ask questions about the API anyway.

Download

Distribution files can be found at www.zigamorph.net:/libnbio/files/.

The latest release is version 0.10.

Contents ©1993–2004 Adam Fritzler <mid@zigamorph.net>.