curl-library
RE: multi-app example not working
Date: Tue, 16 Nov 2010 11:49:39 -0000
What's the right way?
I'm replying to my own post here because I've chased the problem down a
little further.
In the example multi-app.c, there is this code
rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
switch(rc) {
case -1:
/* select error */
break;
case 0:
/* timeout, do something else */
break;
default:
/* one or more of curl's file descriptors say there's data to read
or write */
curl_multi_perform(multi_handle, &still_running);
break;
whereas in eg multi-single.c there is this
rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
switch(rc) {
case -1:
/* select error */
still_running = 0;
printf("select() returns error, this is badness\n");
break;
case 0:
default:
/* timeout or readable/writable sockets */
curl_multi_perform(multi_handle, &still_running);
break;
The latter (multi-single) works just fine because, presumably, when select()
returns 0 it calls curl_multi_perform before looping again. If I alter the
switch statement in multi-app in the same way, all is well.
So the question is, which is the accepted/correct way? What is the
function/intention of the "/* timeout, do something else */" case?
Thanks
Miles
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-11-16