title: Missing bytes when reading from WebClient stream
body: <p>Why am I missing bytes when reading from a WebClient stream as follows?</p>
  
  <pre><code>const int chuckDim = 80;
  
  System.Net.WebClient client = new System.Net.WebClient();
  Stream stream = client.OpenRead("http://media-cdn.tripadvisor.com/media/photo-s/01/70/3e/a9/needed-backup-lol.jpg");
  //Stream stream = client.OpenRead("file:///C:/Users/Tanganello/Downloads/needed-backup-lol.jpg");
  
  //searching file length
  WebHeaderCollection whc = client.ResponseHeaders;
  int totalLength = (Int32.Parse(whc["Content-Length"]));
  byte[] buffer = new byte[totalLength];
  
  //reading and writing
  FileStream filestream = new FileStream("C:\\Users\\Tanganello\\Downloads\\clone1.jpg", FileMode.Create, FileAccess.ReadWrite);
  int accumulator = 0;
  while (accumulator + chuckDim &lt; totalLength) {
      stream.Read(buffer, accumulator, chuckDim);
      filestream.Write(buffer, accumulator, chuckDim);
  
      accumulator += chuckDim;
  }
  stream.Read(buffer, accumulator, totalLength - accumulator);
  filestream.Write(buffer, accumulator, totalLength - accumulator);
  
  stream.Close();
  filestream.Flush();
  filestream.Close();
  </code></pre>
  
  <p>this is what I get with the first stream:
  <a href="http://img839.imageshack.us/img839/830/clone1h.jpg" rel="nofollow">http://img839.imageshack.us/img839/830/clone1h.jpg</a></p>