Mike,
On Tue, Jan 20, 2009 at 8:45 PM, Michael Ash <michael....@gmail.com> wrote: > On Tue, Jan 20, 2009 at 7:49 PM, Mohan Parthasarathy <surut...@gmail.com> > 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 (Cocoa-dev@lists.apple.com) > > 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: > http://lists.apple.com/mailman/options/cocoa-dev/suruti94%40gmail.com > > This email sent to surut...@gmail.com > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com