• 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: How to throttle rate of NSInputStream?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to throttle rate of NSInputStream?


  • Subject: Re: How to throttle rate of NSInputStream?
  • From: "email@hidden" <email@hidden>
  • Date: Tue, 27 Mar 2012 22:36:40 +0100

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 (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: How to throttle rate of NSInputStream?
      • From: Steve Sisak <email@hidden>
References: 
 >How to throttle rate of NSInputStream? (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Example implementation of NSAnimatablePropertyContainer?
  • Next by Date: Re: Can't delete file on device
  • Previous by thread: Re: How to throttle rate of NSInputStream?
  • Next by thread: Re: How to throttle rate of NSInputStream?
  • Index(es):
    • Date
    • Thread