Re: NSURLConnection vs. CURLHandle vs. Others
Re: NSURLConnection vs. CURLHandle vs. Others
- Subject: Re: NSURLConnection vs. CURLHandle vs. Others
- From: Edison Thomaz <email@hidden>
- Date: Wed, 3 Mar 2004 07:29:54 -0800
Hi Dave,
Thanks for your feedback. I'd been thinking about using a timer, as you
suggest. The question to me is, what's the best way to cancel, say a
NSURLConnection or NSURLDownload, through a timer once the calls are in
progress (waiting for data that never comes for example)? It seems to
me that unless you do this very very well, you are going to leak
memory. Were you thinking about doing this in a thread and then sending
it an exit message if something goes wrong.
Thomaz
On Mar 2, 2004, at 12:10 PM, Dave Hersey wrote:
I think the problems with NSURLConnection are limited to synchronous
transfers, which you don't want anyway. So that should work fine.
NSURLDownload can do what you want too. It runs asynchronously, has
delegates for authentication, and you can catch and allow redirects
from a
delegate as well. It does not support caching, but you don't need that
anyway. The timeout is in the request you init with (just like
NSURLConnection). I've used this class without any problems. For me,
it was
handy to have the XML in a file for processing (and debugging), but you
could just toss it if you don't need it.
As far as the max_time goes, can't you just use a timer and cancel the
request if it's taking too long (or if the byte stream stalls)? That
should
work regardless of the connection mechanism you're using.
I haven't used CURLHandle, so I can't help you there.
- Dave
On 3/2/04 2:01 PM, "Edison Thomaz" <email@hidden> wrote:
Hi list,
I am currently writing a data gathering and analysis tool that needs
to
download thousands of XML files every hour. I've been experimenting
with
different strategies for the download of the files and I was
wondering which
one you believe is the most preferable. I am interested in
performance but
also in the ability to control settings such as timeout interval, etc.
Caching and download directly to disk are not features I need, but
being
able to do something in Redirection or Authentication cases are
desirable.
One of the strategies is performing asynchronous downloads using
NSURLConnection. It seems to work well, although I am not sure if
NSURLConnection was built for this kind of load. Considering that
this class
was recently added to Foundation, I wonder if it's already stable and
resilient enough. Apparently, it's still leaky as this thread
indicates:
http://cocoa.mamasam.com/COCOADEV/2004/02/1/84172.php
Also, one of the parameters of NSURLConnection is timeoutInterval,
but it
doesn't seem to work as well as max_time in CURL for example. At
least that
has been my experience.
Another option that seems to work well is to use CURLHandle. It has a
connection-timeout parameter that you can set, which is great, but a
max_time would be even better.
I know that there are lots of socket packages out there that I could
try. Do
you have any suggestions given my app requirements? I'd appreciate it.
Thanks!
Edison Thomaz
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.