I want to know current download progress when im using NetworkStream.Read. Is it even p开发者_Go百科ossible? Do i have to use webclient?
I dont want to use webclient because it seems(im not 100% sure)
- i have to create webserver
- i have to create file (instead of memory stream data).
- i cannot properly measure transfer speed of gigabit networks, due to http protocol limitation.
or, i should use webclient?
FYI, Im building bandwidth estimation tools.
What's the problem?
- Get the current time
- Invoke ´stream.Read(buffer, 0, buffer.Length);` in a loop until you get enough bytes to calculate a proper rate
- Take end time
- Divide the received byte length with number of seconds it took download them.
- Result = bytes/s
精彩评论