This is a collection of samples for using C++20 coroutines with Boost ASIO.
This project is prepared to run in a Visual Studio Code Development Container. It also runs in GitHub Codespaces, although that is very slow. The container image is based on CPP Devcontainer, which contains recent LLVM and Boost versions.
After opening the project in the container, press F7 to compile using CMake. On first startup, the CMake Plugin will ask you for a kit, select [Unspecified] or clang (the latter may take some time to appear, when scanning has finished).
After that, you can open a *.cpp file. This workspace is configured to use the clangd plugin for syntax highlighting and indexing. That may take a while to complete, watch the indexing 1/20 in the status bar. You may have to run the command clangd: Restart language server once for it to pick up on changes to build/compile_commands.json.
There are several implementations of TCP echo servers in this project, for demonstration purposes.
cmake --build build && build/echo/echo_coroTest client:
cmake --build build && build/bin/client -c 10To test interactively, use socat:
# with line buffering
socat STDIN TCP-CONNECT:[::1]:55555
# raw
socat STDIN,raw,echo=0,icrnl,escape=0x03 TCP:[::1]:55555A lot of examples are implement as Google Test units test/test_*.cpp. This way, we can easily run and debug them in Visual Studio Code, using C++ TestMate.
See docs/resources.md.