miron-a

miron-a

  • NA
  • 4
  • 0

The best buffer size for transfering file

Dec 27 2004 12:09 PM
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