curl-library
libcurl and streaming data from push server
Date: Sun, 1 Mar 2009 17:14:46 -0800 (PST)
Hi all
I am a libcurl new user and have been trying to use curl to connect to a push server and request for a streaming reply to be sent to the standard IO. It has been working perfectly for me by doing "curl -o - -N 'push server address'" . But now I am trying to use libcurl to do the same thing in C. I basically have been using the simple.c example withcurl_easy methods and replaced the server address. But it seems the program doesn't return any server replies. I know the push server returns streaming data and does not produce the counter part of the HTML tag. Would this be a problem for the libcurl to wrap up the data and send it to the stdio? How can I simply implement whatever curl is doning with "-o - -N" options using libcurl?
Many thanks,
Z
#include <stdio.h>
#include <curl/curl.h>
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;
}
Received on 2009-03-02