On 27 Mar 2012, at 00:13, Jens Alfke wrote:
> 
> This seems to hinge on the way the stream calls my event handler. When I get 
> the NSStreamEventHasBytesAvailable, I only read 8k bytes of data at a time, 
> then return. What seems to happen is that, if that didn’t consume all of the 
> available data, the stream will keep sending me the event in a tight loop 
> without exiting back to the runloop in between.

Jens

You probably already have this sorted but it occurred to me that when you 
receive NSStreamEventHasBytesAvailable you don't have to read the data there 
and then. You
can defer the actual reading to some later moment and coalesce the reading 
operations. This may cause the NSInputStream to buffer up and give the run loop 
a breather.

Regards

Jonathan Mitchell
Mugginsoft LLP




_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Reply via email to