• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Getting progress of HTTP POST as it's being UPLOADED
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting progress of HTTP POST as it's being UPLOADED


  • Subject: Getting progress of HTTP POST as it's being UPLOADED
  • From: "Daniel Kurtz" <email@hidden>
  • Date: Tue, 29 Aug 2006 16:52:17 -0400

I need to get the status of a POST request as it's being uploaded. I need this information so that I can display how many bytes have been uploaded so far, and how many are left to be written.

I've gone as far as to use setHTTPBodyStream, subclassing NSMutableURLRequest, then overriding the delegate method stream:handleEvent: so I can track the progress of the stream that way. I did so because NSURLRequest is supposed to set the delegate of the NSInputStream as itself, according to the documentation. Even when I attempt this, it seems the delegate method in my subclass is never called:

#import "VEMutableURLRequest.h"


@implementation VEMutableURLRequest

- (void)stream:(NSStream *)stream handleEvent:(NSStreamEvent)eventCode {

    NSLog(@"Stream Event!!");
}

- (void)setHTTPBodyStream:(NSInputStream *)inputStream {
    [super setHTTPBodyStream:inputStream];
    [[self HTTPBodyStream] setDelegate:self];
    NSLog(@"setHTTPBodyStream done");
    NSLog(@"delegate of Stream: %@", [[[self HTTPBodyStream] delegate] className]);
}

@end

The console does show the log information for setHTTPBodyStream:, but it does not show any log information for stream:handleEvent:. I am loading the request this way:

NSURLResponse* response;
NSError* error;
NSData* result = [NSURLConnection sendSynchronousRequest:postRequest returningResponse:&response error:&error];

The POST request is sent correctly, and there's no hitch in the communication with the server. My only problem is that I can't seem to get any delegate messages from the HTTPBodyStream.

Please, if anyone could please help me with this problem, I would really, really appreciate it. Is this even possible with NSURLRequest? If not, how would I go about doing so using a different framework (such as CURLHandle)?

Thanks in advance.

Daniel
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Tunnel.kext alternatives?
  • Next by Date: Re: Tunnel.kext alternatives?
  • Previous by thread: Re: Tunnel.kext alternatives?
  • Next by thread: Re: Getting progress of HTTP POST as it's being UPLOADED
  • Index(es):
    • Date
    • Thread