Re: Getting progress of HTTP POST as it's being UPLOADED
Re: Getting progress of HTTP POST as it's being UPLOADED
- Subject: Re: Getting progress of HTTP POST as it's being UPLOADED
- From: Gary Fielke <email@hidden>
- Date: Wed, 30 Aug 2006 14:01:08 +0930
Daniel,
I need to get the status of a POST request as it's being uploaded.
I need
this information so that I can display how many bytes have been
uploaded so
far, and how many are left to be written.
This is what I've done....
Setup CFHTTPRequest using CFHTTPMessageCreateRequest and associated
functions such as CFHTTPMessageSetHeaderFieldValue,
CFReadStreamCreateWithFile,
CFReadStreamCreateForStreamedHTTPRequest, etc
To get the bytes uploaded, create a timer and call the following
periodically during the upload:
CFNumberRef byteCount = (CFNumberRef)CFReadStreamCopyProperty
(httpReqStream, kCFStreamPropertyHTTPRequestBytesWrittenCount);
this doesn't quite give exactly what we want as it returns the bytes
written to the kernel buffer, not the bytes as they are transmitted
from the buffer.
So your first read of this property will give something like 32k or
64k when the buffer is initially filled, then will increase as the
data is transmitted and the buffer refilled.
Please, if anyone could please help me with this problem, I would
really,
really appreciate it. Is this even possible with NSURLRequest? If
not, how
would I go about doing so using a different framework (such as
CURLHandle)?
Thanks in advance.
Daniel
I'm pretty sure the progress can't be obtained using NSURLRequest. I
tried - I just can't remember why. So definitely use the CFHTTP.....
set of methods.
Cheers
Gary
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden