The Chilkat API provides CKOSocket() , which provides the ability to throttle used bandwidths as follows:
// 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 out for further documentation.
An example in the documentation demonstrates how to use boot bandwidth throttling using the REST API. It will upload the file to Drobox using a stream-limited file stream that can be used for transfer.
source share