• 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: Not getting an NSStreamEventHasBytesAvailable message
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Not getting an NSStreamEventHasBytesAvailable message


  • Subject: Re: Not getting an NSStreamEventHasBytesAvailable message
  • From: Jens Alfke <email@hidden>
  • Date: Thu, 09 Feb 2017 20:34:28 -0800


On Feb 9, 2017, at 8:27 PM, ebach <email@hidden> wrote:

I’m pretty sure you only get another NSStreamEventHasBytesAvailable event once you have processed all the data from the last event.

Hm. But then how do you process all the data without running the risk of blocking? The first read won’t block because you know there’s data, but if you then check hasBytesAvailable and keep issuing read calls, you run the risk that hasBytesAvailable will return a false positive, leaving you blocked. (The docs are pretty clear that it’s allowed to return YES even if it doesn’t know whether there are bytes or not.)

Also, the examples in Apple’s “Stream Programming Guide” only issue a single read call in response to a bytes-available event.

—Jens
 _______________________________________________
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: Not getting an NSStreamEventHasBytesAvailable message
      • From: "Quinn \"The Eskimo!\"" <email@hidden>
References: 
 >Not getting an NSStreamEventHasBytesAvailable message (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Not getting an NSStreamEventHasBytesAvailable message
  • Next by Date: Re: Still interested in (NS)URLSessionStreamTask
  • Previous by thread: Re: Not getting an NSStreamEventHasBytesAvailable message
  • Next by thread: Re: Not getting an NSStreamEventHasBytesAvailable message
  • Index(es):
    • Date
    • Thread