curl-library
Re: using libcurl with persistent connections
Date: Wed, 10 Sep 2014 23:24:58 +0200
On Tue, Sep 09, 2014 at 09:31:16PM -0400, Keith Broerman wrote:
> I'm trying to use libcurl to build a HTTP client that subscribes one time to an
> event service and waits to receive events on a persistent connection. I'm
> starting from the sendrecv.c example code. My libcurl-based client subscribes
> to an event by sending a Http Get to my server-side eventing code (a FastCGI
> process.) I receive the first event back OK. But after that point the select
> () call in wait_on_socket() always indicates that data is available to be read,
> when in fact curl_easy_recv() says there's no data to be read. It's easy to
> see this by commenting out the break statement in the sendrecv.c code below.
This sounds like it's using a normal HTTP transfer, albeit a slow one, in which
case curl_easy_recv() is the wrong API to use. It should be using
curl_easy_perform(), or if you're using the multi API, one of the multi perform
commands instead. Very, very few programs need curl_easy_recv() and
curl_easy_send().
> Any suggestions on what is needed so that the select(readFDs) gets cleared
> after curl_easy_recv() says that all data has been read/processed?
>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-09-10