Spiro Posted February 12, 2003 Posted February 12, 2003 With big file i mean file biger then RecieveBuffer. Dim nStream As NetworkStream If nStream.DataAvailable = True Then Dim recbuf(client.ReceiveBufferSize-1) As Byte nStream.Read(recbuf, 0, client.ReceiveBufferSize) end if Now, RecBuf should hold first 8192 bytes of data. Instead, it holds 7k of valid data and rest is full of 0. When i read 20 times and then write everything to file i got invalid file: 7k valid data, 1k of 00 and so on... How should i solve this? Quote
*Gurus* divil Posted February 12, 2003 *Gurus* Posted February 12, 2003 It sounds to me like you should be writing what you receive to the file every time you receive it, as the receive buffer will only hold what it is dimensioned as. It is best to write continuously like this, otherwise you can end up holding more data than you need to in memory. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Spiro Posted February 12, 2003 Author Posted February 12, 2003 Maybe i should, but it doesn't solve my problem. In the file will be data from RecBuf byte array, with some data and zeros at the end. If i try to append data zeros will remain. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.