Giter Site home page Giter Site logo

chxnet's Introduction

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.

chxnet's People

Contributors

chromoxyx avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.