Skip to content

Scrumplesplunge/asio-with-coroutines

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Boost ASIO with the Coroutines TS

This project is an experiment of mine to see how difficult it is to wrap existing asynchronous APIs using the new Coroutines TS. The project implements a simple asynchronous echo server in two ways. The first way is by using ASIO directly, and is very similar to the echo server example provided in the boost documentation. The second way is by writing a small amount of boilerplate to wrap the ASIO interface, and then simply writing some coroutines for the echo server.

Requirements

To compile this code, you will need clang 5, the corresponding libc++, and boost. If you are using archlinux and pacaur, you can get all three of these with:

pacaur -S clang boost libc++

The project can then be built with make, make opt or make debug.

Project Layout

The conventional implementation using asio is in classic_asio.cc. The coroutines implementation is broken into two parts: coroutine_wrappers.{h,cc} contain the boilerplate for converting the API to coroutines, and coroutines_asio.cc contains the echo server.

The boilerplate code in coroutine_wrappers does not cater specifically to the echo server use case, which is why I have separated it from the echo server implementation.

About

A simple experiment with the coroutines ts and boost asio.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published