Section: cp_httpclient (3)
Updated: MAY 2006
Return to Main Contents
cp_httpclient_fetch_ctl_exec - perfrom an http call
cp_httpclient_fetch(cp_httpclient *client, char *uri);
int cp_httpclient_fetch_nb(cp_httpclient *client, char *uri,
void *id, cp_httpclient_callback callback,
int cp_httpclient_fetch_ctl(cp_httpclient_ctl *ctl,
char *uri, void *id,
int cp_httpclient_fetch_ctl_exec(cp_httpclient_ctl *ctl);
the fetch functions operate on a successfully initialized the cp_httpclient
and attempt to retrieve the content under the given
synchronous interface - cp_httpclient_fetch
performs an HTTP call and returns a
object containing a status code and the results, if any, represented as a
object. This method will block until fully reading the server response or an
asynchronous interface - cp_httpclient_fetch_nb
adds the HTTP request to an execution stack and returns immediately. Results
are obtained when a callback is made to the specified
function, which must follow this prototype:
void (*callback)(cp_httpclient_result *response);
The callback function is invoked once results have been read from the server or
an error occurs.
parameter is non-zero, requests will be performed by a background thread.
Otherwise transfers must be driven by calling
which returns the number of on-going transfers. A return value of zero
indicates all transfers have completed. If the return value is non-zero
cp_httpclient_fetch_nb_exec must be called again. To prevent spinning, or more
generally to determine whether there is data to send or receive on any of the
connections, applications should retrieve an array of
structures by calling
and use this array to call
with a non-zero timeout value. Pass a non-null pointer to an int value to
cp_httpclient_ctl_default_get_pollfds for the
parameter to be set to the size of the struct pollfd array.
To execute requests by group or to control the number of threads involved in
performing background transfers, applications may dynamically create a transfer
Adding requests is then done with cp_httpclient_fetch_ctl. If the control
stack is not initialized to perform transfers in a separate thread (or
threads), applications must control execution with
and polling on the struct pollfd array given by
returns NULL on internal memory allocation failures, a cp_httpclient_result
object representing the transfer result otherwise.
return zero on success or non-zero if the request could not be registered.
return -1 on memory allocation failure, or the number of executing requests on
the default or user created transfer stack respectively. A value of zero
indicates that all transfers have completed (or none were requested yet).
- synchronous interface - cp_httpclient_fetch
- asynchronous interface - cp_httpclient_fetch_nb
- grouping transfers
- RETURN VALUE
- SEE ALSO
This document was created by
using the manual pages.
Time: 23:42:32 GMT, May 09, 2006