• 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
connectionDidFinishLoading is not invoked after 1 minute
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

connectionDidFinishLoading is not invoked after 1 minute


  • Subject: connectionDidFinishLoading is not invoked after 1 minute
  • From: ico <email@hidden>
  • Date: Wed, 26 Jan 2011 18:22:28 +0800

Hi All,
Greeting.

Hi, My app will call a webservice to load data. Every time I send the request by using URL loading async, the method connection:didReceiveData: is invoked very quickly, and I put a NSLog statement inside this method, I can see that the data I receive is just the same as shown in HTTP header field Content-Length. So there should be no more data need to be received. In fact, connection:didReceiveData is not invoked any more. But my connectionDidFinishLoading is invoked exactly 1 minute later every time. Right, exactly 1 minute, not more or less. Any idea what is going on?

I wonder how NSURLConnection to judge if data is received completed and then call the connectionDidFinishLoading method. Something like a '\0' to indicate the data is finish transferring? Or just compare the content length in the HTTP header and the bytes are received? If it is judge by '\0', the server side does not send this byte so my program wait until it is timeout internally(that's why it delays exactly 1 minute to call connectionDidFinishLoading every time?) Just guessing.

Here is the code:

- (void) connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
NSLog(@"connection did receive data......");
NSLog(@"before resRawData length:%u", [resRawData length]);
NSLog(@"data length:%u", [data length]);
[resRawData appendData:data];
NSLog(@"after resRawData length:%u", [resRawData length]);
}

- (void) connectionDidFinishLoading:(NSURLConnection *)connection {
NSLog(@"connection finished loading.................");
}


log:

2011-01-26 18:07:37.376 WPForumPortal[6018:40b] connection did receive data......
2011-01-26 18:07:37.377 WPForumPortal[6018:40b] before resRawData length:0
2011-01-26 18:07:37.377 WPForumPortal[6018:40b] data length:4427
2011-01-26 18:07:37.377 WPForumPortal[6018:40b] after resRawData length:4427
2011-01-26 18:08:37.376 WPForumPortal[6018:40b] connection finished loading.................

--
==========================
Life isn't about finding yourself.
Life is about creating yourself.

 _______________________________________________
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

  • Follow-Ups:
    • Re: connectionDidFinishLoading is not invoked after 1 minute
      • From: "Quinn \"The Eskimo!\"" <email@hidden>
  • Prev by Date: Re: Problem w. FTP port 21
  • Next by Date: Re: connectionDidFinishLoading is not invoked after 1 minute
  • Previous by thread: Re: Problem w. FTP port 21
  • Next by thread: Re: connectionDidFinishLoading is not invoked after 1 minute
  • Index(es):
    • Date
    • Thread