Hey,

Thanks for the info. I'll certainly look into the CFNetwork API. I was really 
hoping for a nice solution to come about for the cocoa API's but I've since 
given up hope and started using libcurl, which is actually a really nice 
library to work with.

Thanks for all the help

> Subject: Re: NSRunloop + shared thread
> From: hank.l...@runbox.com
> Date: Fri, 20 Nov 2009 09:28:02 -0500
> CC: colde...@hotmail.com; cocoa-dev@lists.apple.com
> To: j...@mooseyard.com
> 
> On Nov 19, 2009, at 7:51 PM, Jens Alfke wrote:
> 
> > On Nov 19, 2009, at 3:40 PM, Colin Deasy wrote:
> > 
> >> This shared thread is actually handling potentially large numbers of 
> >> concurrent url connections/downloads. The reason that I want a block in 
> >> some of those at different times is a for a form of bandwidth control I am 
> >> trying to do.
> > 
> > I don't think that will do what you want. The actual socket I/O happens in 
> > a background thread owned by CFNetwork; I don't think that thread will stop 
> > reading data just because your callback on the main thread hasn't returned 
> > yet. It just means that, when you do return, you'll immediately get a 
> > bigger chunk of data.
> > 
> > I've seen this general question of rate limiting asked on the 
> > macnetworkprog list. IIRC the answer is that Foundation and CFNetwork don't 
> > really give you the tools to do it. You'd have to write your own code using 
> > low-level BSD sockets APIs. :-P
> 
> You can actually do this using CFNetwork. If you schedule your read stream on 
> a runloop and read the bytes you want in the appropriate callback (one of 
> type CFReadStreamClientCallBack) with CFReadStreamRead, you can successfully 
> control the bandwidth by limiting the number of calls to CFReadStreamRead.
> 
> Hank
> 
                                          
_________________________________________________________________
Windows 7: Find the right PC for you. Learn more.
http://windows.microsoft.com/shop_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to