title: NetworkStream.CanRead returns true but the buffer returns no value
body: <p>I have a do while loop that reads a buffer from a <code>NetworkStream</code> object
  the while condition is <code>networkStream.CanRead</code> so as long as it can read, it should continue reading from the buffer. Only problem is when I read from the buffer and convert to string, there is nothing in it. i.e. its empty.</p>
  
  <p>Why would that happen?</p>
  
  <p>This is an ASP.NET(VS2005) application</p>
  
  <p>@dtb Code Info:</p>
  
  <p>I am passing the a <code>NetworkStream</code> object <code>networkStream</code></p>
  
  <pre><code>// between 2 functions in a loop
  {
      SendMessage(networkStream, message);
  
      ReadMessage(networkStream);
  }
  </code></pre>
  
  <p>Funny thing is that if it reconnects and connects again, the Send/ Read works fine. Can it actually be a problem with Send ( I am getting no exceptions here) or reuse of the <code>NetworkStream</code> object. This is working fine locally on a test TCP server, but I am getting the above problem when in production (Windows Server 2003) (i.e. can't read anything from the stream -- until I actually time it out (exit the loop) after 10s)</p>
  
  <pre><code>ReadMessage(networkStream)
  {
      if (networkStream != null &amp;&amp; networkStream.CanRead)
      {
          byte[] myReadBuffer = new byte[1024];
          StringBuilder myCompleteMessage = new StringBuilder();
  
          do
          {
              int numberOfBytesRead = networkStream.Read(myReadBuffer, 0, myReadBuffer.Length);
              string messageRead = Encoding.ASCII.GetString(myReadBuffer, 0, numberOfBytesRead);
              myCompleteMessage.Append(messageRead);
          } while (networkStream.CanRead);
      }
  }
  </code></pre>