Completion callbacks

A completion callback signals an application that an asynchronous routine has completed.

A context or a connection is defined to be asynchronous so that routines that read to or write from the network return immediately rather than blocking until the necessary I/O operations have completed. The value of a connection structure’s CS_NETIO property determines whether Client-Library routines behave asynchronously. See “Network I/O” for details.

When a connection is asynchronous, Client-Library routines that perform network I/O return CS_PENDING immediately rather than completing the requested operation before returning. In a fully asynchronous application (CS_NETIO is CS_ASYNC_IO), a completion callback is needed to notify the mainline code of the asynchronous operation’s completion.

For more information on Client-Library’s asynchronous programming modes, see “Asynchronous programming”.