In Client-Library, every routine that reads or writes from the network can behave asynchronously. These routines are:
ct_connect, ct_close, ct_options
ct_send, ct_cancel, ct_results, ct_fetch
ct_get_data, ct_send_data
ct_recvpassthru, ct_sendpassthru
blk_init, blk_done
blk_sendrow, blk_sendtxt
blk_rowxfer, blk_textxfer
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.
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.
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.