> On Feb 9, 2017, at 8:27 PM, ebach <eba...@gmail.com 
> <mailto:eba...@gmail.com>> 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      (Macnetworkprog@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/macnetworkprog/archive%40mail-archive.com

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

Reply via email to