title: Converting sync code (with BinaryReader) to using async/await for NetworkStream
body: <p>I'm trying to figure out how to wait for data on a <code>NetworkStream</code> using the task based async / wait approach recommended by Microsoft. </p>
  
  <p>so far im just looping untill data becomes available, whch is probaby bad:</p>
  
  <pre><code>using (NetworkStream stream = client.GetStream())
  {
      while (true)
      {
          if (stream.CanRead &amp;&amp; stream.DataAvailable)
          {
              using(BinaryReader reader = new BinaryReader(stream))
              {
                  byte data = reader.ReadByte();
              }
          }
      }
  }
  </code></pre>