Skip navigation.
 
mlLimiting upload speed
FROM : patrick machielse
DATE : Fri Jan 11 00:48:58 2008

I'm writing an application that potentially uploads a LOT of data to a 
remote server (think GB). This upload activity should not impair the 
normal usage of (network) applications (too much), and so I'm looking 
for a way to limit the upload speed of my program.

To upload the data I create HTTP POST forms in NSData which I send 
using NSURLConnection / NSURLRequest. It has been suggested to me that 
I can use -[NSMutableURLRequest setHTTPBodyStream:] and use my own 
custom NSInputStream subclass to control the rate at which bytes are 
sent. However, it seems that subclassing NSInputStream (used in 
conjunction with NSURLConnection?) are broken in Mac OS X 10.4 (and 
10.5 in my experience).

<http://lists.apple.com/archives/macnetworkprog/2007/May/msg00053.html>

Using the a standard NSInputStream and registering as delegate doesn't 
work either, because the URL request assumes that role.

- Can I make this work in Cocoa? (maybe by subclassing 
NSMutableURLRequest instead...)
- Should I use some lower level framework to achieve my goal?
- Should I take a completely different approach to the problem?

TIA,

patrick machielse
Hieper Software

Related mailsAuthorDate
No related mails found.