cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Multiple download portability?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 26 Dec 2007 23:53:44 +0100 (CET)

On Wed, 26 Dec 2007, Andreas Volz wrote:

> One more question about portability. I use the file:// protocol in some
> situations to have a unique API for network and local file operations. To
> download multiple files I experiment with only one thread and the select()
> function. Currently I'm using Linux and don't expect any problems. But I'm
> thinking forward to the Win32 port. I know that in Win32 the select() call
> works only for socket, but not for plain files on the local file system.

Correct!

> Could you tell me what curl does internal while using the file:// protocol.
> Is this a real socket which I could use with select() on Win32 or is it in
> reality a file handle?

In reality, libcurl will never "expose" the file transfer in the multi
interface so you'll never get the file descriptor for that particular
transfer. The file transfer will be done synchronously in the file transfer's
DO action. This can of course be a long operation if you transfer a large file
(and a file:// file can indeed even be a file on a slow network).

> If this doesn't work on Win32, then I'll redesign my application to use
> threads for multiple downloads.

It works, but it might not be the best idea anyway.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-12-27