Calculate speed per sec and time left of sending a file using sockets tcp c#

前端 未结 3 1848
慢半拍i
慢半拍i 2021-01-15 04:16

How can I calculate the speed per sec, and the time left in sec? I\'ve tried to use:

void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) {
    l         


        
3条回答
  •  温柔的废话
    2021-01-15 04:41

    You may do some smoothing of the transfer speed to avoid jumping of the value. See http://en.wikipedia.org/wiki/Moving_average for one option. Basically compute some sort of average for the speed over time.

提交回复
热议问题