public static void ReadWholeArray (Stream stream, byte[] data)
{
int offset=0;
int remaining = data.Length;
while (remaining > 0)
{
int read = stream.Read(data, offset, remaining);
if (read <= 0)
throw new EndOfStreamException(String.Format("End of stream reached with {0} bytes left to read", remaining));
remaining -= read;
offset += read;
}
}
size of byte array data is 2682 on the first iteration of while loop the value of read is 1658 on the next iteration after executing the line
int read = stream.Read(data, offset, remaining);
the program is not responding
what is the problem?