Re: [OSX Core Foundation]How can I asynchronously upload a file though HTTP and get a callback called while sending bytes of the stream?
Re: [OSX Core Foundation]How can I asynchronously upload a file though HTTP and get a callback called while sending bytes of the stream?
- Subject: Re: [OSX Core Foundation]How can I asynchronously upload a file though HTTP and get a callback called while sending bytes of the stream?
- From: Rémy Saissy <email@hidden>
- Date: Wed, 1 Dec 2010 17:46:27 +0100
Ok thanks, I will try it.
I would prefer to avoid using Cocoa since my launch agent is
exclusively written using CF.
Thank you.
Regards.
On Wed, Dec 1, 2010 at 1:18 PM, Quinn "The Eskimo!" <email@hidden> wrote:
>
> On 1 Dec 2010, at 08:20, Rémy Saissy wrote:
>
>> If somebody has some tips about how to do it, it would be great. Thanks a lot!
>
> You should be able to do this using NSURLConnection. Let's break this down by task:
>
> o large transfers -- If you're uploading a plain file, you can create a stream for that file using either CF or NSStream and then set it as the content body using -[NSMutableURLRequest setHTTPBodyStream:].
>
> If the file needs some sort of header or trailer you'll have to use a bound pair of streams, as illustrated by the PostController class in the SimpleURLConnections sample code (which is for iOS, but the technology works identically on Mac OS X).
>
> <http://developer.apple.com/library/ios/#samplecode/SimpleURLConnections/>
>
> o resume -- The exact mechanics of resume are dependent on your server. If, for example, you're using a WebDAV-style server, you can resume simply by using an HTTP PUT with the appropriate content range header. See RFC 2616 for the details.
>
> <http://www.ietf.org/rfc/rfc2616.txt>
>
> To resume a file stream upload, you'll need to use kCFStreamPropertyFileCurrentOffset to seek the body stream before you start the second transfer.
>
> o progress -- NSURLConnection passes you upload progress information via the -connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite: delegate callback.
>
> S+E
> --
> Quinn "The Eskimo!" <http://www.apple.com/developer/>
> Apple Developer Relations, Developer Technical Support, Core OS/Hardware
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Macnetworkprog mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
--
Rémy Saissy
Web: http://picasaweb.google.fr/remy.saissy
"J'aime les belles plantes car cela me donne envie de devenir jardinier."
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden