Reputation: 1847
I want keep a NSURLConnection
open, and upload data via chunked transfer encoding. I have a buffer that reads in data, and as soon as I read in the data, I want to upload this data. I won't know how much data will be read ahead of time, so I need to keep the connection open.
From what I've seen on Stackoverflow, I've seen recommendations such as setHTTPBodyStream
, ASIHTTPRequest
, etc. However, I believe all of those does not allow me to add more data to the connection once it's opened.
Is there any way to do this in iOS? Any recommendation is welcome.
Thanks.
Upvotes: 2
Views: 851
Reputation: 539695
I did not actually try this myself, but have a look at "PostController.m" in the SimpleURLConnections sample project from the Apple Developer Library.
It shows how to create a socket pair where the reading end (consumerStream
in the sample code) is used as HTTPBodyStream
for the URL request, and you can write your data to the writing end (producerStream
).
Upvotes: 2