title: Not receiving all data with networkstream.read
body: <p>I'm using the following code to get newsgroups from a server:  </p>
  
  <pre><code>sendBytes = Encoding.ASCII.GetBytes("LIST active microsoft.public*" &amp; ControlChars.CrLf)
  networkStream.Write(sendBytes, 0, sendBytes.Length)
  Array.Clear(bytes, 0, bytes.Length)
  If networkStream.CanRead Then
      Do
          numberOfBytesRead = networkStream.Read(myReadBuffer, 0, myReadBuffer.Length)
          myCompleteMessage.AppendFormat("{0}", Encoding.ASCII.GetString(myReadBuffer, 0, numberOfBytesRead))
          intLenMyReadBuf = myReadBuffer.Length
          intLenComplMsg = myCompleteMessage.Length
          swWriter.WriteLine("buf len = " &amp; intLenMyReadBuf &amp; ", msg len = " &amp; intLenComplMsg)
          Loop While networkStream.DataAvailable
  Else
      Console.WriteLine("Sorry.  You cannot read from this NetworkStream.")
  End If
  
  sendBytes = Encoding.ASCII.GetBytes("QUIT " &amp; ControlChars.CrLf)
  networkStream.Write(sendBytes, 0, sendBytes.Length)
  tcpClient.Close()
  networkStream.Close()
  </code></pre>
  
  <p>When I execute the code, the routine only receives one block of the data. However, if I go into
  debug mode with a breakpoint at the loop instruction, I receive all of the blocks of data.<br>
  Am I missing something in the code, like a wait or something, that would allow the program to<br>
  receive all data like happens with the debug?</p>