calculate sending file speed/sec by taking the average of 5 times of sent bytes [duplicate]
This question already has an answer here: Calculate speed per sec and time left of sending a file using sockets tcp c# 3 answers im trying to calculate the transfer file speed per second using the average i took the different between the sent bytes sum and the prevSum 5 times per second does the code below give me the correct speed? should i change the rate array size ? or should i change Thread.Sleep(value) ? im so confused because each time a change a little thing the speed value changes.. what's the correct solution for that ?? static long prevSum = 0; static long[] rate = new long[5];