This tutorial demonstrates the use of libasync through simple and less simple examples. For a thorough discussion of all the nuts and bolts in libasync (and more examples), consult Using libasync.
Roughly, libasync allows you to respond to events (usually on file descriptors) through callbacks. A callback is just a C/C++ function or method. The programmer defines what callback is associated with which event and libasync invokes that callback function when the event occurs.
There are many examples in this tutorial. All files are available in the examples/ directory. Also, you can click on the filename above each example.
This is a summary of the wisdom that awaits you.
Lesson 1: Hello, World!
Simple callback example using
Lesson 2: Callbacks with parameters Passing parameters to callback functions.
Lesson 3: Callbacks as parameters
callback<...> type, explains how to
pass callback functions as parameters to callback functions, and
demonstrates how to pass parameters to callback functions that are
passed as parameters to callback funtions. Did I make myself clear at
Lesson 4: Gory details:
Nasty details you need to know related to garbage collection.
Lesson 5: Client sockets
How to create a client socket (using
and how to read/write from/to that socket.
Lesson 6: Server sockets
How to create a server socket (using
inetsocket) and how to
read/write from/to that socket.
GO! (...to Lesson 1)