• 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: Wed, 21 Jan 2009 09:40:53 -0800

Mike,


On Tue, Jan 20, 2009 at 8:45 PM, Michael Ash <email@hidden> wrote:

> On Tue, Jan 20, 2009 at 7:49 PM, Mohan Parthasarathy <email@hidden>
> wrote:
> >>  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 ?
> >>>
> >>
> >> Again, I'm pretty sure that the Cocoa URL loading functions will do this
> >> for you as appropriate. Trying to implement it yourself is unnecessary,
> and
> >> trying to go about it this particular way is futile as well as
> incorrect.
> >
> >
> > I don't want to do this myself. But i don't see anything in
> NSURLConnection
> > that would do this. If so, please point to me.
>
> *Do* *not* *make* *assumptions*.
>
> You're making a huge assumption here:
>
> A) NSURLConnections must be reused in order to have persistent HTTP
> connections.
>
> And then we have this simple fact:
>
> B) There is no way to reuse an NSURLConnection.
>
> Putting these two together, we have a conclusion:
>
> C) NSURLConnection does not allow persistent HTTP connections.
>
> Since conclusion C is pretty much absurd, it would follow that perhaps
> assumption A is wrong.
>

I have been doing networking for a long time but i admit that i am new to
Cocoa and Objective C. I did use Wireshark to see what happens when
initWithRequest multiple times and there was only one TCP connection, but
multiple GETs. Then i was told that using init multiple times is wrong which
did not occur to me inspite of reading Cocoa Guide and a book that i am
slowly trying examples with.


>
> But don't assume. *Test*. Write some code and then use a network
> sniffer to see if, in fact, persistent connections are being used.


Ah! this is the part i assumed. Sorry. When i release an NSURLConnection, i
assumed that all resources are released. It never occured me that
underneath, a connection will be maintained. I did see the TCP connection
close but i did not see the time when it was closed. Bad part on me.


> If you don't know how to use a sniffer, this is your golden
> opportunity to learn. Doing network programming without a sniffer is
> like doing carpentry without any eyes. A particularly talented person
> might get astonishingly far without them, but he's still going to
> suffer from a severe handicap relative to a person who can actually
> see.
>
> Above all, please don't come barging onto the mailing list asking
> about a half-baked solution for a problem that you haven't even
> verified the existence of.


Sorry, next time i will do my homework thoroughly.

-mohan


>
> Mike
> _______________________________________________
>
> 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
>
_______________________________________________

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

References: 
 >NSURLConnection changing the URL (From: "Mohan Parthasarathy" <email@hidden>)
 >Re: NSURLConnection changing the URL (From: Andrew Farmer <email@hidden>)
 >Re: NSURLConnection changing the URL (From: "Mohan Parthasarathy" <email@hidden>)
 >Re: NSURLConnection changing the URL (From: Andrew Farmer <email@hidden>)
 >Re: NSURLConnection changing the URL (From: "Mohan Parthasarathy" <email@hidden>)
 >Re: NSURLConnection changing the URL (From: Michael Ash <email@hidden>)

  • Prev by Date: Re: Newbie Memory Questions on a Code Fragment
  • Next by Date: Re: Limiting NSTextField to numbers?
  • Previous by thread: Re: NSURLConnection changing the URL
  • Next by thread: Accessing interface elements (iPhone vs Mac)
  • Index(es):
    • Date
    • Thread