[OSX Core Foundation]How can I asynchronously upload a file though HTTP and get a callback called while sending bytes of the stream?
[OSX Core Foundation]How can I asynchronously upload a file though HTTP and get a callback called while sending bytes of the stream?
- Subject: [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 09:20:22 +0100
Hi, on MacOSX, with Core Foundation, I want to upload large files
(several hundreds of megabytes) to a remote server through a REST API.
Since files are big and I also need to give the user some feedback, I
want to implement a resume upload feature and gives the user feedback
on the number of bytes written.
Resume implies, from my standpoint, to be able to seek in the
ReadStream of the local content on an event like kCFStreamEventOpen
and the number of bytes written is he property
kCFStreamPropertyHTTPRequestBytesWrittenCount on the WriteStream (the
network connection).
I first followed the Apple Guide for CFNetwork programming:
http://developer.apple.com/library/ios/#documentation/Networking/Conceptual/CFNetwork/CFFTPTasks/CFFTPTasks.html#//apple_ref/doc/uid/TP30001132-CH9-SW1
But the asynchronous upload of file is for FTP only.
I tried to use CFReadStreamCreateForHTTPRequest butI only got
callbacks on response. I tried with
CFReadStreamCreateForHTTPStreamedRequest and I set a delegate on the
ReadStreamRef body parameter but it is never called even though I open
the stream before actually scheduling it on the runloop.
But I am unable to set an HTTP WriteStream to the server and to set
Client Delegate on the ReadStream to get my notifications for the
resume functionality.
If somebody has some tips about how to do it, it would be great. Thanks a lot!
--
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