cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl and streaming data from push server

From: Z Sun <zhsun_53_at_yahoo.com>
Date: Mon, 2 Mar 2009 14:29:06 -0800 (PST)

Thanks again, Daniel. Basically I am trying to use libcurl to capture the push server output and then parse it with extra code. So I am avoiding to activate curl to do the job from a command shell, but I didn't find a way to reproduce it using libcurl yet  (not by the simple.c anyway). My guess is once the request is sent, then libcurl would arrest  the response and either save it in a buffer or output it to a file or a stdio, right. Now can this response be displayed instantly - without buffering delays or wait for the response signal to be complete? Is this implemented in the CURL_WRITEFUNCTION, or elsewhere?  Z > How can I simply implement whatever curl is doning with "-o - -N" > options?using libcurl? ? You're already doing it: > ? int main(void) > ? { > ?? CURL *curl; > ?? CURLcode res; > ? > ?? curl = curl_easy_init(); > ?? if(curl) { > ???? curl_easy_setopt(curl, CURLOPT_URL, "push server address"); > ???? res = curl_easy_perform(curl); > ?? > ???? /* always cleanup */ > ???? curl_easy_cleanup(curl); > ?? } > ??? return 0; > ? } You can of curse use "curl --libcurl example.c [url]" to get a decent initial set of options for the exact command line you use. "-o - -N" really is no magic at all... --   / daniel.haxx.se
Received on 2009-03-02