#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);
To be sure to have up-to-date results, you should call curl_multi_perform until it does not return CURLM_CALL_MULTI_PERFORM prior to calling curl_multi_fdset. This will make sure that libcurl has updated the handles' socket states.
If no file descriptors are set by libcurl, max_fd will contain -1 when this function returns. Otherwise it will contain the higher descriptor number libcurl set.
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 activity 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.