cURL / Mailing Lists / curl-library / Single Mail

curl-library

curl_easy_perform occasionally responds even though the PC is disconnected from the network

From: Johnny Beardsmore <jny0_at_hotmail.com>
Date: Mon, 20 Sep 2010 14:46:49 +0000

Hi,

I'm using the following (abreviated) code:

//**************************************************
curl_easy_reset(curl);
curl_wr_error = curl_wr_index = 0;

// setup curl options
curl_easy_setopt(curl, CURLOPT_URL, CURL_SERVER);

// Tell curl that we'll receive data to the function write_data, and
// also provide it with a context pointer for our error return.
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *) &curl_wr_error);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_write_data);

char send_data[CURL_MAX_POST];
strcpy(send_data,buffer);

curl_easy_setopt(curl, CURLOPT_POSTFIELDS, send_data);

ret = curl_easy_perform(curl);

printf("\nSEND_DATA REPORT---> Server Response: %s", &curl_wr_buf[1]);
//**************************************************

I call curl_easy_perform approximatly every 5 seconds. When I'm connected to the network, it works fine. When I disconnect, curl_easy_perform doesn't get a response (which is what you'd expect), but approximately every 80 calls, it does, i.e. ret contains a value. What's even more confusing, is the value matches the expected MD5 response. What could be causing this? It would seem like a time out to me, it it wasn't for the *valid* reponse.

Regards,
jny
                                               

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-09-20