Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

curl_multi_wait(3) [osx man page]

curl_multi_wait(3)						  libcurl Manual						curl_multi_wait(3)

curl_multi_wait - polls on all easy handles in a multi handle SYNOPSIS
#include <curl/curl.h> CURLMcode curl_multi_wait(CURLM *multi_handle, struct curl_waitfd extra_fds[], unsigned int extra_nfds, int timeout_ms, int *numfds); DESCRIPTION
This function polls on all file descriptors used by the curl easy handles contained in the given multi handle set. It will block until activity is detected on at least one of the handles or timeout_ms has passed. The calling application may pass additional curl_waitfd structures which are similar to poll(2)'s pollfd structure to be waited on in the same call. On completion, if numfds is supplied, it will be populated with the number of file descriptors on which interesting events occured. If no extra file descriptors are provided and libcurl has no file descriptor to offer to wait for, this function will return immediately. This function is encouraged to be used instead of select(3) when using the multi interface to allow applications to easier circumvent the common problem with 1024 maximum file descriptors. curl_waitfd struct curl_waitfd { curl_socket_t fd; short events; short revents; }; CURL_WAIT_POLLIN Bit flag to indicating the socket should poll on read events such as new data received. CURL_WAIT_POLLPRI Bit flag to indicating the socket should poll on high priority read events such as out of band data. CURL_WAIT_POLLOUT Bit flag to indicating the socket should poll on write events such as the socket being clear to write without blocking. RETURN VALUE
CURLMcode type, general libcurl multi interface error code. See libcurl-errors(3) AVAILABILITY
This function was added in libcurl 7.28.0. SEE ALSO
curl_multi_fdset(3), curl_multi_perform(3) libcurl 7.28.0 12 Jul 2012 curl_multi_wait(3)

Check Out this Related Man Page

curl_multi_fdset(3)						  libcurl Manual					       curl_multi_fdset(3)

curl_multi_fdset - extracts file descriptor information from a multi handle SYNOPSIS
#include <curl/curl.h> CURLMcode curl_multi_fdset(CURLM *multi_handle, fd_set *read_fd_set, fd_set *write_fd_set, fd_set *exc_fd_set, int *max_fd); DESCRIPTION
This function extracts file descriptor information from a given multi_handle. libcurl returns its fd_set sets. The application can use these to select() on, but be sure to FD_ZERO them before calling this function as curl_multi_fdset(3) only adds its own descriptors, it doesn't zero or otherwise remove any others. The curl_multi_perform(3) function should be called as soon as one of them is ready to be read from or written to. If no file descriptors are set by libcurl, max_fd will contain -1 when this function returns. Otherwise it will contain the higher descrip- tor number libcurl set. When libcurl returns -1 in max_fd, it is because libcurl currently does something that isn't possible for your application to monitor with a socket and unfortunately you can then not know exactly when the current action is completed using select(). When max_fd returns with -1, you need to wait a while and then proceed and call curl_multi_perform anyway. How long to wait? I would sug- gest 100 milliseconds at least, but you may want to test it out in your own particular conditions to find a suitable value. When doing select(), you should use curl_multi_timeout to figure out how long to wait for action. Call curl_multi_perform even if no activ- ity has been seen on the fd_sets after the timeout expires as otherwise internal retries and timeouts may not work as you'd think and want. If one of the sockets used by libcurl happens to be larger than what can be set in an fd_set, which on POSIX systems means that the file descriptor is larger than FD_SETSIZE, then libcurl will try to not set it. Setting a too large file descriptor in an fd_set implies an out of bounds write which can cause crashes, or worse. The effect of NOT storing it will possibly save you from the crash, but will make your program NOT wait for sockets it should wait for... RETURN VALUE
CURLMcode type, general libcurl multi interface error code. See libcurl-errors(3) SEE ALSO
curl_multi_cleanup(3), curl_multi_init(3), curl_multi_timeout(3), curl_multi_perform(3) libcurl 7.16.0 2 Jan 2006 curl_multi_fdset(3)
Man Page