Limiting upload speed

  • 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
previous month january 2008 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today