0
Reply

The best buffer size for transfering file

miron-a

miron-a

Dec 27 2004 12:09 PM
1.8k
Hi all, I'm using the following function to trasfer file via lan between two computers: byte[] TransferBuffer = new byte[BUFFER_SIZE] ; TCPsocket = new TcpClient(); NetStream = TCPsocket.GetStream() ; while( len > 0 ) { len=FileToTransfer.Read(TransferBuffer,0,TransferBuffer.Length) ; NetStream.Write(TransferBuffer,0,len); TotalSent=TotalSent+len ; } My quastion is: what is the best "BUFFER_SIZE" to use to have the best performence ? to get the fastest transfering rate ? thanx all, Miro