title: SslStream equivalent of TcpClient.Available?
body: <p>Based on the advice of @Len-Holgate <a href="https://stackoverflow.com/questions/5143716/net-asynchronous-socket-operations-limit">in this question</a>, I'm asynchronously requesting 0-byte reads, and in the callback, accept bytes the available bytes with synchronous reads, since I know the data is available and won't block.  This seems so efficient and wonderful.</p>
  
  <p>But then I add the option for SslStream, and the approach falls apart.  The zero-byte read is fine, but the SslStream decrypts the bytes, leaving a zero byte-count in the TcpClient's buffer (appropriately so), and I cannot determine how many bytes are now in the SslStream available for reading.</p>
  
  <p><strong>Is there a simple trick around this?</strong></p>
  
  <hr>
  
  <p>Some code, just for context:</p>
  
  <pre><code>sslStream.BeginRead(this.zeroByteBuffer, 0, 0, DataAvailable, this);
  </code></pre>
  
  <p>And after the EndRead() ( which correctly returns 0 ), DataAvailable contains:</p>
  
  <pre><code>// by now this is 0, because sslStream has already consumed the bytes
  available = myTcpClient.Available; 
  
  if (0 &lt; available) // Never occurs
  {
      // this part can be distractingly complicated, but 
      // it's based on the available byte count
      sslStream.Read(...); 
  }
  </code></pre>
  
  <p>And due to the protocol, I need to evaluate byte-by-byte and decode variable byte-width unicode and stuff.  I don't want to have to read byte-by-byte asynchronously!</p>