2017-08-03 14:12 GMT+08:00 Ray Satiro via curl-library < [email protected]>:
> On 8/2/2017 4:45 AM, Pahome Chen via curl-library wrote: > > Curl version: curl 7.54.0. libcurl/7.54.0 OpenSSL/1.0.2g zlib/1.2.8 > > > > I use libcurl to download files from s3 bucket and apply two > > interface: multi_socket and easy. > > > > Both interface download 1MB one time. > > > > Execution order in log is below: > > > > socket callback: s=16 e=0x7f4cb4020230 Adding data: OUT > > socket callback: s=16 e=0x7f4cb4020230 Change action from OUT to IN. > > easy_perform starte. Download 1MB. ->Download finished. > > easy_perform starte. Download 1MB. -> Download finished. > > socket callback: s=16 e=0x7f4cb4020230 Removing. > > multi_socket download done. > > > > In code snippet the two interface use the same curl_easy_setopt() such > > as CURLOPT_WRITEFUNCTION > > CURLOPT_HTTPHEADER > > CURLOPT_URL...etc. > > > > I have questions about that the two interface will affect each other? > > I thought the multi_socket interface will download first that the > > latter easy interface. > > You are using multi_socket_action and then in the middle of that you > call easy_perform on some other handles? or (I really hope) is that > happening in a separate thread? I do it in different threads. I call easy_perform in one thread when I add multi handle in another one thread. > In any case if the easy_perform > downloads have finished first any number of factors could contribute to > that. You can only guarantee the order of synchronous downloads because > libcurl would wait for one to finish before going on to the next one. In > other words easy_perform(a); easy_perform(b); easy_perform(c); > guaranteed order because the calls are blocking, a then b then c. > curl_multi_add_handle(multi, a); curl_multi_add_handle(multi, b); > curl_multi_add_handle(multi, c); no guaranteed order. bac, cba, acb, etc > > Maybe the two interface won't affect each other? -- Best Regards, pahome
------------------------------------------------------------------- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html
