cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: TFTP and the Multi Interface

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 30 Dec 2008 23:31:24 +0100 (CET)

On Tue, 30 Dec 2008, Chad Monroe wrote:

>> Just FYI: this shortcoming is actually documented in the libcurl-multi.3
>> man page.

> Now that you point it out, I see it in the docs :). I'll take a look at it,
> but if you have any pointers regarding implementation before I dive in it'd
> be much appreciated.

Well, first you need to start thinking in a non-blocking way, and the entire
transfer process that needs to be written to never rely on anything to happen
in a blocking manner. This typically results in getting the transfer stuff
done by some kind of state machine so that repeated calls can continue where
it was left off before. The lib/ssh.c and lib/ftp.c are examples of that
practise.

Then it helps to remember that the multi interface, or perhaps everything
within libcurl, is done in pretty much the same way:

CONNECT
DO
PERFORM
DONE
[ possibly repeat at DO for further transfers ]
DISCONNECT

... as that is reflected in internal function naming and the Curl_handler
struct and more. The Curl_handler is a struct that is initialized for each
supported protocol and it contains a set of function pointers that is used by
libcurl where protocol-specific treatment is required or needed.

Oh, and just ask if there's anything in particular that you can't figure out!

-- 
  / daniel.haxx.se
Received on 2008-12-30