cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curlpp mailing list Archives

[cURLpp] non blocking single transfers and callbacks to progress bar updates

From: Leigh <leighm_at_linuxbandwagon.com>
Date: Wed, 15 Jun 2005 12:10:59 +1000

Hi all!

just working off the form post example, have read a fair bit about adding a
progress callback to the CURLOPT_PROGRESSCALLBACK, however i get a
segfault/accessDenied in transfer.c, around line 1370 when it calls
Curl_pgrsUpdate(conn)

Also, any ideas on making the whole show non-blocking so my UI can keep ticking
over?

--
  if(Curl_pgrsUpdate(conn))
    result = CURLE_ABORTED_BY_CALLBACK;
  else
    result = Curl_speedcheck(data, k->now);
  if (result)
    return result;
---
Heres the code i am using..
connection::connection() {
	curl_global_init(CURL_GLOBAL_ALL);
	curl_formadd(&formpost,
			   &lastptr,
			   CURLFORM_COPYNAME, "sendfile",
			   CURLFORM_FILE, infile,
			   CURLFORM_END);
	curl_formadd(&formpost,
			   &lastptr,
			   CURLFORM_COPYNAME, "filename",
			   CURLFORM_COPYCONTENTS, infile,
			   CURLFORM_END);
	curl_formadd(&formpost,
			   &lastptr,
			   CURLFORM_COPYNAME, "submit",
			   CURLFORM_COPYCONTENTS, "send",
			   CURLFORM_END);
	curl = curl_easy_init();
	headerlist = curl_slist_append(headerlist, buf);
	if(curl) {
	/* what URL that receives this POST */
	curl_easy_setopt(curl, CURLOPT_URL, url);
	curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
	curl_easy_setopt(curl, CURLOPT_NOPROGRESS, FALSE);
curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_callback);
	res = curl_easy_perform(curl);
---
}
int connection::progress_callback(void *nothing, double dltotal, double dlnow,
double ultotal, double ulnow) {
//	printf("dltotal: %d, dlnow: %d, ultotal: %d, ulnow: %d \n", dltotal, dlnow, 
ultotal, ulnow);
    return 0;
}
thanks
leigh
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


_______________________________________________
cURLpp mailing list
cURLpp_at_rrette.com
http://www.rrette.com/mailman/listinfo/curlpp

Received on 2005-06-15

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET