I develop a speed test software with a graph. Each seconds, i draw the throughput on the graph. I use socket with a loop on socket.read(...)
The problem is the buffer size. If i set the buffer to 32ko, when the speed is low, my graph is wrong (block on read function until the buffer isn't full). If i set the buffer to 512 octets, the speed is "flanged".
How to set dynamically the buffer size ?
block on read function until the buffer isn't full
I don't know what that means. Socket reads don't attempt to fill the buffer, they wait until some data arrives and then move that into the buffer, whatever its length, up to the size of the buffer. The size of the buffer should have no effect when speeds are low. It will take effect when speeds are high.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With