The Chilkat API provides a CKOSocket()
that provides the possibility to throttle the used bandwidths like this:
// To use bandwidth throttling, the connection should be made using the socket API.
// This provides numerous properties to customize the connection, such as
// BandwidthThrottleDown, BandwidthThrottleUp, ClientIpAddress, ClintPort, Http Proxy,
// KeepAlive, PreferIpv6, RequireSslCertVerify, SoRcvBuf, SoSndBuf, SoReuseAddr,
// SOCKS proxy, TcpNoSDelay, TlsPinSet, TlsCipherSuite, SslAllowedCiphers, etc.
let socket = CkoSocket()
var maxWaitMs: Int = 5000
var success: Bool = socket.Connect("content.dropboxapi.com", port: 443, ssl: true, maxWaitMs: maxWaitMs)
if success != true {
print("\(socket.LastErrorText)")
print("Connect Fail Reason: \(socket.ConnectFailReason.integerValue)")
return
}
// Set the upload bandwidth throttle rate to 50000 bytes per second.
socket.BandwidthThrottleUp = 50000
Check this for further documentation.
The example in the documentation demonstrates how to use upload bandwidth throttling with the REST API. It will upload a file to Drobox using a file stream, with a limit on the bandwidth that can be used for the transfer.