Re: CFReadStreamCopyProperty() returns NULL?
Re: CFReadStreamCopyProperty() returns NULL?
- Subject: Re: CFReadStreamCopyProperty() returns NULL?
- From: John Michael Zorko <email@hidden>
- Date: Sun, 08 Feb 2009 13:58:51 -0800
Jens,
I would guess that you can't access the response data until the
stream has connected and read data. I'm not sure about the
concurrency model of CFReadStream used with HTTP messages; it might
be asynchronous, or you might have to tell it to read first.
I thought that CFReadStreamOpen() did that? I guess not, at least in
this case, so i'll look into that ...
But the higher level question is, why are you using such a low-level
API instead of NSURLConnection? The latter will make your life much
easier, and it supports more HTTP features too, like redirects.
NSURLConnection caches data and doesn't let me, the developer, control
how much I read from the socket. This led to huge memory usage in my
iPhone app, as NSURLConnection would happily read way ahead into the
stream and cache it, causing the iPhone OS to send my app low memory
warnings. Moving to a CFNetwork-based solution let me control when
and how much I read from the stream, and it fixed the memory issues I
was having.
The downside is that, while NSURLConnection handled all of this stuff
for me, I now have to do it myself. It's worth it to me, though :-)
Regards,
John
Falling You - exploring the beauty of voice and sound
http://www.fallingyou.com
_______________________________________________
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