Client-Library asynchronous support

In Client-Library, every routine that reads or writes from the network can behave asynchronously. These routines are:

Client-Library provides two models of asynchronous programming: fully asynchronous and polling.

By default, connections behave synchronously. You must request the asynchronous programming model by setting the CS_NETIO property to CS_ASYNC_IO (for fully asynchronous behavior) or CS_DEFER_IO (for the polling model). When set at the context level, the setting affects all subsequently allocated connections. You can also set the property for each connection individually.

Fully asynchronous model

In the fully asynchronous model, the application installs completion callbacks, and Client-Library invokes the callback each time an asynchronous routine completes. The fully asynchronous model is supported only on platforms that have interrupt-driven network I/O capabilities or on platforms where Client-Library uses operating-system threads to perform network I/O.

Polling model

In the polling model, the application calls ct_poll in a loop after each call to an asynchronous routine that returns CS_PENDING. The polling model is supported on all platforms. If you are concerned about portability, use the polling model when writing asynchronous applications.

For a more detailed description of these programming models, see the “Asynchronous Programming” topics page in the Open Client Client-Library/C Reference Manual.