Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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?

  • *Gurus*
Posted
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.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Posted
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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...