Skip to content

An async network I/O library, imitates boost.asio, based on io_uring and liburing, for educational purpose.

License

Notifications You must be signed in to change notification settings

ChromoXYX/chxnet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chxnet

An async network I/O library, imitates boost.asio, based on io_uring and liburing, for educational purpose. Now support basic tcp I/O and C++20 coroutine.

TCP echo server with end-of-line marker

UDP example

Simple http server, which always responses with headers of requests

Coroutine, and singled-threaded when_any

Note:

Only gcc is supported, and the minimum version requirement is 12.1.

Full functionality requires a minimum kernel version 5.19. But most basic operations are available on older kernels.

Functionalities or operations that require a kernel version higher than 5.15:

  • Cancellation of an async object, 5.19. (If not satisfied, destructor of async objects cannot cancel async tasks associated with itself, leads to bad memory access. To avoid this, use a reference-counter such as shared_ptr.)

Dependency

How to build

Run shell:

autoreconf -i -v
./configure
# ./configure --with-liburing=/path/to/liburing if liburing not in system default paths.
# See ./configure --help for details.
make

Design

  1. Task management layer (level-1, io_context)

    Level-1 provides async task allocation and life cycle management services for level-2.

  2. Async Operation layer (level-2, detail::async_operation)

    All basic I/O operations are implemented in level-2, e.g. async_read and async_write.

  3. Userland layer (level-3, I/O objects, async_combine)

    Level-3 provides abstraction and encapsulation based on level-2, such as ip::tcp::socket.

    Users could also combine multiple level-2 operation by async_combine.

TODO

  • Add udp support.
  • Add kernel-free timer support.
  • Add level-3 multithread support.

About

An async network I/O library, imitates boost.asio, based on io_uring and liburing, for educational purpose.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published