curl-library
RE: Recommended architecture for streaming over multiple sockets
Date: Wed, 9 Mar 2016 15:29:17 +0000
>I bet this is the piece of code i need to change:
>
> if (bSomethingToDo)
> {
> // Call multi_perform
> curl_multi_perform(m_pstCurlMultiHandle, &iRunningFDs);
> }
> else
> {
> usleep(10000);
> }
>This might seem trivial for you but i'm still learning libcurl and i find the documentation quite misleading for starters like me..
>
You could get the finished transfers (from whatever reason) with curl_multi_info_read [1]
Instead of usleep, you should call curl_multi_wait [2] which will return to your thread code once there is an event on the sockets / timeout.
Please look at the code example on curl_multi_wait, it might help you a lot.
[1] https://curl.haxx.se/libcurl/c/curl_multi_info_read.html
[2] https://curl.haxx.se/libcurl/c/curl_multi_wait.html
HTH
Yehezkel Horowitz
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-03-09