• 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
Re: NSURLConnection changing the URL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSURLConnection changing the URL


  • Subject: Re: NSURLConnection changing the URL
  • From: "Mohan Parthasarathy" <email@hidden>
  • Date: Tue, 20 Jan 2009 13:36:43 -0800

On Tue, Jan 20, 2009 at 1:23 PM, Andrew Farmer <email@hidden> wrote:

> On 20 Jan 09, at 12:22, Mohan Parthasarathy wrote:
>
>> I want to be able to establish the TCP connection to a server and do
>> multiple HTTP GETs with different URLs. I thought will achieve this by
>> allocating a NSURLConnection and then initWithRequest:urlRequest with a
>> different URL everytime as there is no other way to set the URL. It looks
>> like that this is not working and the URL is not changing.
>>
>
> Initializing ObjC objects multiple times is always incorrect. Don't do it!


Ok. Is it because init assumes that it is allocating memory for the first
time and hence may cause leaks if called multiple times ? At least it seems
to work now.

>
>
>  Is there a way to not to allocate the connection everytime i need to send
>> a new request ?
>>
>
> Yes. I'm pretty sure that the URL loading framework will use HTTP
> keepalives automatically when appropriate.


I am not sure i undrstood this.  If i allocate a NSURL connection everytime
i need to fetch from a URL, wouldn't it set up a TCP connection everytime
and then download the data. If i can avoid that, wouldn't it be nice ?

>
>
>  While debugging, i found that sending a description message to
>> NSURLConnection coredumps. Is that right or a bug in my program ?
>>
>
> This is probably a side-effect of multiple initialization.
>
Ah! Okay..

-thanks
mohan
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSURLConnection changing the URL
      • From: Andrew Farmer <email@hidden>
References: 
 >NSURLConnection changing the URL (From: "Mohan Parthasarathy" <email@hidden>)
 >Re: NSURLConnection changing the URL (From: Andrew Farmer <email@hidden>)

  • Prev by Date: Re: Trying to display a simple sheet
  • Next by Date: Re: [XCode] Generating method stubs
  • Previous by thread: Re: NSURLConnection changing the URL
  • Next by thread: Re: NSURLConnection changing the URL
  • Index(es):
    • Date
    • Thread