On Thu 5 Sep 2013, Steve Holme wrote: > Does select() always indicate that there is data waiting to be read > even after previous reads or is it a one-time notification?
Modifying Curl_pp_statemach() to perform a read into a temporary buffer seems to solve the problem: if(Curl_pp_moredata(pp)) /* We are receiving and there is data in the cache so just read it */ rc = 1; else if(!pp->sendleft && !Curl_read(conn, sock,buf, sizeof(buf), &nread) && nread) { /* We have data waiting but may not receive a FDREAD from select() */ rc = 1; pp->cache = malloc(nread); pp->cache_size = nread; memcpy(pp->cache, buf, nread); } else rc = Curl_socket_ready(pp->sendleft?CURL_SOCKET_BAD:sock, /* reading */ pp->sendleft?sock:CURL_SOCKET_BAD, /* writing */ interval_ms); I don't like this, hence why the code isn't production ready (no failed check on the malloc call) but I'm not sure how else to tackle it at the moment. Is there a way to test if there is data waiting without using select() / peek at the socket buffer? Kind Regards Steve ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html