-
Stream Problem
Hi. I am sending some data over a networkstream.
The datasize is 97
The buffersize is 1.
Data is a list of bytes.
When the bytecount reaches 94 the do while loop exist itself.
Any ideas why?
Code:
While Stream.CanRead
Do
ByteCount += Stream.Read(Buffer, 0, BufferSize)
Data.AddRange(Buffer)
If ByteCount = 94 Then
Console.WriteLine("BC: " & ByteCount)
Console.WriteLine("DS: " & DataSize)
End If
Loop While ByteCount < DataSize
End While
-
Re: Stream Problem
Could we see the whole code? Are you sure the DataSize variable is initialized to 97?
And it could be completing it properly once it reaches 94 it will output those two lines then check the condition and since it is less than 97 (check DataSize variable to be sure) it will execute again but this time i would assume the byteCount is different so it wont output anything because it doesn't equal 94 therefore it wont do much except the first two lines...
To know exactly what is wrong we need to see the full function code at least.