cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Reusing open connections with FTP

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Thu, 15 Jan 2009 12:15:12 -0800

On Thu, Jan 15, 2009 at 07:30:18PM +0000, G. T. Stresen-Reuter wrote:
> I read somewhere that cURL will reuse open FTP connections for multiple
> transfers to/from an FTP server (and probably to/from any other type of
> server).
>
> When using the cURL tool (rather than libcurl which probably has a file
> pointer), how is this accomplished?
>
> For example, if I have a series of files to be uploaded to varying
> folders on the same server, how would the command look to make sure the
> same connection gets used?
>
> curl -T file1.txt ftp://myserver.com/uploads/ -T file2.txt
> ftp://myserver.com/images/ -T file3.txt ftp://myserver.com/css/

This should work.

> vs. (3 separate commands)
>
> curl -T file1.txt ftp://myserver.com/uploads/
> curl -T file2.txt ftp://myserver.com/images/
> curl -T file3.txt ftp://myserver.com/css/
>
> I'm asking because I'm calling cURL from a bash script, currently one
> bash for each file, and I doubt cURL is able to use the same connection
> opened in a different process, but I may be wrong...

You're right--once curl exits, all open connections are closed. So the
uploads all have to be done on the same command-line.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
-------------------------------------------------------------------
List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2009-01-15