Streaming a file as it gets recorded?

  • Sorry my first email went out prematurely...

    Anyhoo, I'm trying to stream an audio file up to a server as it gets
    recorded, using NSMutableURLRequest and an NSInputStrem.  The problem
    I'm having is that if I start streaming while the file is still
    getting recorded, then I only end up sending the beginning of the
    file, and as soon as sending catches up to recording, the transfer
    stops.

    Is there a nice, simple way to get the file to continue streaming
    until it's done being written?

    I'm trying to do something like the following.

    NSURL *cgiUrl = [NSURL URLWithString: urlStr];
    NSMutableURLRequest *postRequest = [NSMutableURLRequest requestWithURL:cgiUrl];

    //setting the headers:
    [postRequest setHTTPMethod:@"POST"];
    [postRequest addValue: @"application/octet-stream" forHTTPHeaderField:
    @"Content-Type"];

    //adding the body:
    fileStream = [[NSInputStream inputStreamWithFileAtPath: recordingFile] retain];
    [postRequest setHTTPBodyStream: fileStream];

    // Make the request
    NSURLConnection *theConnection=[[NSURLConnection alloc]
    initWithRequest:postRequest:  delegate:self];

    Thanks,
    Ben
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