title: How to get all data from NetworkStream
body: <p>I am trying to read all data present in the buffer of the Machine connected through <code>TCP/IP</code> but i don't know why i am not getting all data ,some data is getting Missed.
  Here is the code that i am using ..</p>
  
  <pre><code>using (NetworkStream stream = client.GetStream())
  {
      byte[] data = new byte[1024];
      int numBytesRead = stream.Read(data, 0, data.Length);
      if (numBytesRead &gt; 0)
      {
         string str= Encoding.ASCII.GetString(data, 0, numBytesRead);
      }
  }
  </code></pre>
  
  <p>Please tell me what i am missing to get all the data from the machine.
  Thanks in advance..</p>