title: How should you handle the possibility of an NSStream blockage?
body: <p>Per Apple’s “Polling Versus Run-Loop Scheduling”:</p>
  
  <blockquote>
    <p>[<code>hasSpace/BytesAvailable</code>] can mean that there is available bytes or space <em>or</em> that the only way to find out is to attempt a read or a write operation (which could lead to a momentary block).</p>
  </blockquote>
  
  <p>The doc does not explicitly state that hasSpace/BytesAvailable <em>events</em> behave the same way, only, obscurely, that they have “identical semantics."</p>
  
  <p>Am I to conclude that a write/read streamError or a bytes read/written return of less than the amount expected could be due to a “momentary block”?</p>
  
  <p>If so, should I attempt the transmission again? Should I use some sort of timer mechanism to give the blockage a chance to clear? This would be a lot of work to implement, so I’d rather not if it’s unlikely to help.</p>
  
  <p>(It’s tempting to initiate a limited polling loop in such a case, say a while loop that makes 10 attempts, but I don’t know if it’s safe to do that at the same time as the stream is scheduled in the run loop, and I have no way to test it.)</p>