Re: PC to PC file transfer



OK, this is a buffer issue it seems but I still cannot solve it.
Please help someone! I think it is a buffer issue because of the
following:


Dim numBytesRead As Integer
Dim BUFFER_SIZE As Integer = FTPClient.ReceiveBufferSize <--- this
value comes out at 8192

numBytesRead = NWstream.Read(bytesToRead, 0, BUFFER_SIZE)
FileSTR.Write(bytesToRead, 0, BUFFER_SIZE)


The file size is 211 bytes that I am testing with. So, the above code
writes out the 211 bytes and then files the file until it contains 8192
bytes. If I debug the code, after the 211 bytes have passed each
subsequent byte has a value of 0 (zero).

First of all, any ideas why it is doing this and not stopping when the
filestream has read it's 211 bytes like it is supposed to? And second,
any ideas on how to fix it? I tried setting the buffer size manually
to 211 bytes but then the file length is 8 bytes in size.

This is driving me crazy!

TIA

.



Relevant Pages