Reputation: 4269
I am using this code to write the connectstream to memorystream:
buffer = new byte[8 * 1024];
while ((len = stream.Read(buffer, 0, buffer.Length)) > 0)
{
mStream.Write(buffer, 0, len);
}
But I always get an error:
there was a problem reading this document (109)
Upvotes: 0
Views: 821
Reputation: 942348
After the loop is completed, the MemoryStream is left positioned to the end of the stream. Reading from it isn't going to produce anything. Add:
mStream.Position = 0;
Upvotes: 1