Not receiving all data with networkstream.read
I'm using the following code to get newsgroups from a server:  

    sendBytes = Encoding.ASCII.GetBytes("LIST active microsoft.public*" & 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 = " & intLenMyReadBuf & ", msg len = " & intLenComplMsg)
        	Loop While networkStream.DataAvailable
    Else
    	Console.WriteLine("Sorry.  You cannot read from this NetworkStream.")
    End If

    sendBytes = Encoding.ASCII.GetBytes("QUIT " & ControlChars.CrLf)
    networkStream.Write(sendBytes, 0, sendBytes.Length)
    tcpClient.Close()
    networkStream.Close()
 
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.          
Am I missing something in the code, like a wait or something, that would allow the program to     
receive all data like happens with the debug?

Not receiving all data with networkstream.read
===

I'm using the following code to get newsgroups from a server:  

    sendBytes = Encoding.ASCII.GetBytes("LIST active microsoft.public*" & 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 = " & intLenMyReadBuf & ", msg len = " & intLenComplMsg)
        	Loop While networkStream.DataAvailable
    Else
    	Console.WriteLine("Sorry.  You cannot read from this NetworkStream.")
    End If

    sendBytes = Encoding.ASCII.GetBytes("QUIT " & ControlChars.CrLf)
    networkStream.Write(sendBytes, 0, sendBytes.Length)
    tcpClient.Close()
    networkStream.Close()
 
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.          
Am I missing something in the code, like a wait or something, that would allow the program to     
receive all data like happens with the debug?
