Sortix nightly manual
This manual documents Sortix nightly, a development build that has not been officially released. You can instead view this document in the latest official manual.
curl_multi_fdset(3) | Library Functions Manual | curl_multi_fdset(3) |
NAME
curl_multi_fdset - extract file descriptor information from a multi handleSYNOPSIS
#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 does not 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.PROTOCOLS
This functionality affects all supported protocolsEXAMPLE
int main(void)
{
fd_set fdread;
fd_set fdwrite;
fd_set fdexcep;
int maxfd;
int rc;
CURLMcode mc;
struct timeval timeout = {1, 0};
CURLM *multi = curl_multi_init();
do {
/* call curl_multi_perform() */
/* get file descriptors from the transfers */
mc = curl_multi_fdset(multi, &fdread, &fdwrite, &fdexcep, &maxfd);
if(mc != CURLM_OK) {
fprintf(stderr, "curl_multi_fdset() failed, code %d.\n", mc);
break;
}
/* wait for activity on one of the sockets */
rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
} while(!mc);
}
AVAILABILITY
Added in curl 7.9.6RETURN 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_perform(3), curl_multi_timeout(3), curl_multi_wait(3), curl_multi_waitfds(3), select(2)2024-11-21 | libcurl |