cURL / Mailing Lists / curl-library / Single Mail

curl-library

libcurl speed-limit problem

From: asmvc <asmvc_at_163.com>
Date: Mon, 23 Jul 2007 17:31:47 +0800 (CST)

i use libcurl to download http file and found some problem when i set download speed limit.i set the max-speed = 100k but no effect my code: #include <curl/curl.h> #define BUFF_SIZE 100*1024
#define LIMIT 100*1024 int my_write(void *ptr,size_t size,size_t nmemb,void *stream)
{
 size_t rc;
 
 rc = size*nmemb; return rc;
} int main()
{
 CURLcode ret;
 CURL *hnd; hnd = curl_easy_init(); curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 0);
 curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, BUFF_SIZE);
 curl_easy_setopt(hnd, CURLOPT_URL, "http://192.168.1.169/2.rmvb");
 
 curl_easy_setopt(hnd, CURLOPT_WRITEDATA, NULL);
 curl_easy_setopt(hnd, CURLOPT_WRITEFUNCTION, my_write);
 
 curl_easy_setopt(hnd, CURLOPT_LOW_SPEED_LIMIT, 0);
 curl_easy_setopt(hnd, CURLOPT_LOW_SPEED_TIME, 0);
 curl_easy_setopt(hnd, CURLOPT_MAX_SEND_SPEED_LARGE, (curl_off_t)LIMIT);
 curl_easy_setopt(hnd, CURLOPT_MAX_RECV_SPEED_LARGE, (curl_off_t)LIMIT);
 ret = curl_easy_perform(hnd);
 curl_easy_cleanup(hnd); return 1;
}
who can help me ?
Received on 2007-07-23