Bandwidth throttling small amounts of data.
Question:
I’m sending ~50kb jpeg files alongside a very bandwidth-intensive
application, so I want to make sure that my application doesn’t use
more than 10kb/s, so that even those with slow connections will not have
this other application impacted by mine.
Answer:
Concerning bandwidth throttling — it only makes sense with larger amounts of data (much more than 50K). Here’s why: Sockets are used for sending and receiving data over TCP/IP connections. Buffering occurs at both the software (within Microsoft’s Winsock) and hardware levels. Therefore, an application might pass 50K to a socket “send” call and it would return immediately. It’s very difficult for an application to throttle a connection until a large stream of data is being sent (much larger than 50K). (We know this because throttling is implemented in Chilkat’s FTP2 component.) I would say that it make sense to “throttle” by delaying between 50K sends. Allowing the 50K in a “burst” but throttling many 50K transfers over time is probably the best you can do anyway.