• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CFReadStreamCopyProperty() returns NULL?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: CFReadStreamCopyProperty() returns NULL?
      • From: Jens Alfke <email@hidden>
References: 
 >CFReadStreamCopyProperty() returns NULL? (From: John Michael Zorko <email@hidden>)
 >Re: CFReadStreamCopyProperty() returns NULL? (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: CFReadStreamCopyProperty() returns NULL?
  • Next by Date: Re: CFReadStreamCopyProperty() returns NULL?
  • Previous by thread: Re: CFReadStreamCopyProperty() returns NULL?
  • Next by thread: Re: CFReadStreamCopyProperty() returns NULL?
  • Index(es):
    • Date
    • Thread