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

  • SEARCH
  • Home
  • 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 6876313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:27:41+00:00 2026-05-27T04:27:41+00:00

I followed below code to establish https connection in my application to fetch some

  • 0

I followed below code to establish https connection in my application to fetch some data in xml format in my iphone (iOS4) application.

  1. Creating a connection using NSURLConnection
  2. connection:didReceiveResponse: implementation
  3. connection:didReceiveData
  4. connectionDidFailWithError
  5. connectionDidFinishLoading

I referred exacly following to establish connection:
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html

Everything works fine for a single connection. But if I try 2 (or more) connections simultaneously (each connection being in separate thread), and if first connection is being served, then second connection gets discarded.

The second connection never gets queued up. It is simply discarded. Only first is served.

What can be the issue? My requirement is to create multiple (at least 2) connection simultaneously.

Also, Please share sample code or link or example if possible.
Thanks

  • 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-27T04:27:41+00:00Added an answer on May 27, 2026 at 4:27 am

    It’s not a simple task to run NSURLConnection in separate thread. If you just execute NSURLConnection in separate thread, you can not handle delegate methods because your thread is finished before your code actually executed.


    After you initialized the NSURLConnection object, you actually need to
    put the class in an infinite loop to make sure the class is still
    alive when the delegate methods are hit.

    NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:urlReq delegate:self];
    
    while(!finished) {
        [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
    }
    
    - (void) connectionDidFinishLoading:(NSURLConnection *)connection
    {
        finished = TRUE;
    }
    

    See this article – NSURLConnection in its own thread

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

Sidebar

Related Questions

I have followed the sample code below to upload a zip file in the
I followed the commonly-linked tip for reducing an application to the system tray :
I followed the Core Data tutorial at http://macresearch.org/cocoa-scientists-part-xxiii-itunes-ifying-core-data-app The finished application displays data in
I followed this tutorial: https://github.com/EllisLab/CodeIgniter/wiki/PDF-generation-using-dompdf However, I can't seem to set the path right.
The code below generates the text for the e-mail that is sent when a
I have the Global.asax like the code below: public class MvcApplication : System.Web.HttpApplication {
I need some Regex help. I need to find beacon_ followed by an alphanumeric
So I am building an iPhone application with in app purchasing, and I'm trying
I have the code below in an attempt to allow the user to Step
My question has to do with facetting. In my example code below, I look

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.