Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6213203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:39:12+00:00 2026-05-24T06:39:12+00:00

I have some code here: (…) NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; if(

  • 0

I have some code here:

(...)
NSURLConnection *theConnection = [[NSURLConnection alloc] 
                initWithRequest:theRequest delegate:self];
if( theConnection )
{
    webData = [[NSMutableData data] retain];
}

and delegate methods:

-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{   
    NSLog(@"zero");
   [webData setLength: 0];
}

-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
    NSLog(@"got %d", [data length]);
    [webData appendData:data];
}

-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
    NSLog(@"ERROR with theConenction");
    [connection release];
    [webData release];
}

-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{

    NSLog(@"DONE. Received Bytes: %d", [webData length]);
    [connection release];
    [webData release];      
}

It works pretty good untill more data has to come.
Than NSURLConnection “stop working” (with no error, no exception, no quit). I can still use my app.
I noticed that problem begin when didReceiveData is being called more than once during the connection.

How it looks like step by step from debugger:

1. I call theRequest
2. Delegate call didReceiveResponse

2010-06-21 18:10:16.708 MyApp[9477:207] zero

3. Delegate call didReceiveData

2010-06-21 18:10:16.709 MyApp[9477:207] got 6912

(gdb) continue

4. Delegate call didReceiveData (once again)

2010-06-21 18:10:18.027 MyApp[9477:207] got 114067

(gdb) continue

--> and here is the problem <--

main loop continue with no breakpoint, and connectionDidFinishLoading is not called.
Everything is ok when didRecieveData is being called just once.

5. Delegate call didFailWithError (after 5 min!)

2010-06-21 18:15:18.041 MyApp[9477:207] ERROR with theConenction
Connection failed! Error – The operation couldn’t be completed. Connection reset by peer

(gdb) continue

=============== UPDATE ====================

Finally, I have discovered one important thing: True problem is that remote host doesn’t finish connection in proper way sometimes (ie. big amount of data), so delegate connectionDidFinishLoading can’t be called and after 5 min remote host reset connection.

Has anyone the problem too and can help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T06:39:14+00:00Added an answer on May 24, 2026 at 6:39 am

    Finally, I’ve workarounded the issue using ASIHTTPRequest

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have some old C code here that's built with nmake. Is there an
I have some code where I'm returning an array of objects. Here's a simplified
Here's my problem - I have some code like this: <mx:Canvas width=300 height=300> <mx:Button
Here's the situation: We have some generic graphics code that we use for one
I have a piece of code here that i really could use some help
I have seen the following code: [DefaultValue(100)] [Description(Some descriptive field here)] public int MyProperty{...}
I have some code here which works perfectly in firefox but not in chrome
I have some code here, and don't really understand the >> and the &.
I have some code here : http://bitbucket.org/natim/lo53_tp1/src/tip/part3/camions/medias/js/tracking.js That I use to draw some information
So I have some code here that takes user input from a standard web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.