cURL / Mailing Lists / curl-library / Single Mail

curl-library

CURLOPT_CONNECT_ONLY

From: Ramprakash Jelari thinakaran <jelari_at_gmail.com>
Date: Tue, 15 Apr 2008 14:38:42 +0530

Hi all,

I have set CURLOPT_CONNECT_ONLY. and invoking curl_easy_perform()

std::ostringstream httpResponse;
curl_easy_setopt(ehandler, CURLOPT_WRITEFUNCTION, BURAdataWrite_Callback);
curl_easy_setopt(ehandler, CURLOPT_WRITEDATA, &httpResponse);
curl_easy_setopt(handler, CURLOPT_CONNECT_ONLY, 1);
ret = curl_easy_perform(handler);

*In this case, is it a valid operation to capture the reply from Server
through write callback?*

size_t Write_Callback(void* data, size_t size, size_t nmemb, void* input)

{

std::ostringstream *os= static_cast<std::ostringstream*>(input);

cout<<endl<<"Write_Callback Called "<<endl;

char *cstr=static_cast<char*>(data);

size_t len = size * nmemb;

if(!(os->write(cstr, len))) return CURLE_WRITE_ERROR;

return len;

}
because, the application is getting crashed!..

-- 
Regards,
Ramprakash Jelari
"TeamWork is the fuel that allows commom people to attain uncommon results"
Received on 2008-04-15