~/talk

How to Use C++20 Coroutines for Networking

Talkat ACCU 2022 · 2022-04-06..04-09· [c-and-cpp, networking]
slides:none on file

Shows a concrete recipe: prototype the chat in Lua prototype to learn suspension, then implement it in C++20 using co_await suspension semantics and Boost.Asio + GCC 11.2 + Boost 1.78. Compares three implementations (blocking ~49 lines, callback ~100 lines, coroutine ~50 lines) and a full chat example (~134 lines). Explains awaiters, promise types, coroutine_handle, co_spawn, suspend/resume mechanics, nonblocking stdin technique, and where library support (generators, executors) is heading.

AI-written summary · about

  1. 0:00Start
  2. 1:14Poll
  3. 3:10Co-Routines the Fundamentals
  4. 7:43Benefit of Coroutines
  5. 8:58Multi-Threading
  6. 9:21Example Is an Echo Server
  7. 11:06Blocking Server
  8. 12:48Asynchronous Version
  9. 13:21Asynchronous Programming
  10. 15:19Accept Handler
  11. 17:27Co-Spawn
  12. 17:58Completion Token
  13. 21:37Co Routine Support in C plus plus 20
  14. 23:31Traits
  15. 24:46Tips for Learning
  16. 27:12Key References
  17. 32:16Chat Program
  18. 44:17Co-Routine Return Type
  19. 45:50Promise Type
  20. 46:20Customizing Car Weight
  21. 46:49Disable Car Weight on Certain Types
  22. 47:50Curvaturing Handles
  23. 48:44Example of a Generator
  24. 49:53Random Number Generator
  25. 50:44Co Routines Return Type
  26. 53:20Initial Suspend
  27. 57:31Networking Example of a Generator
  28. 57:47Packet Generator
  29. 1:00:39Design
  30. 1:01:46The Io Context
  31. 1:03:31Boost Timers
  32. 1:03:52Read the Keyboard
  33. 1:12:45Conclusion
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.