FTP multiple files via a single socket connection

Sannyasin Sivakatirswami katir at hindu.org
Wed Sep 24 00:19:01 EDT 2003


We note that use of libURLftpUploadFile command requires a complete 
socket handshake with the server for each iteration if one is sending 
multiple files on a loop:

as in: (for two files uploaded on after another...

257 "/" is current directory.
250 CWD command successful.
250 CWD command successful.
200 Type set to I.
227 Entering Passive Mode (64,75,176,66,37,161)
150 Opening BINARY mode data connection for 
/export/vhost/org/w/wherever/www/public_html/9-23-03.jpg.
CLOSED 64.75.176.66:9633|6939
226 Transfer complete.
257 "/" is current directory.
250 CWD command successful.
250 CWD command successful.
200 Type set to I.
227 Entering Passive Mode (64,75,176,66,174,26)
150 Opening BINARY mode data connection for 
/export/vhost/org/w/wherever/www/public_html/9-23-04.jpg.
CLOSED 64.75.176.66:44570|6939
226 Transfer complete.
257 "/" is current directory.
250 CWD command successful.

Our fire wall isn't super happy with this 'rain" of socket requests in 
PASSIVE mode (even though we are the client)...and starts barking about 
"attack under way... closing socket" after about the 12th iteration. ( 
i don't understand why, since in passive mode it's the server that is 
being "attacked" with uploads... not the client...) anyway...

  Is there a way, using the current libURL to upload up the files 
through  a single ip-port that is opened only once on the control 
connection at the beginning of the FTP session as we see with a normal 
FTP client transaction log as in:

(interarchy on the mac.... three files, one after another, but it will 
hold onto the same IP address, even for 75 files.. )

TYPE I
200 Type set to I.
PORT 192,168,1,230,192,232
200 PORT command successful.
STOR 9-23-07.jpg
150 Opening BINARY mode data connection for 9-23-07.jpg.
226 Transfer complete.
PORT 192,168,1,230,192,233
200 PORT command successful.
STOR 9-23-08.jpg
150 Opening BINARY mode data connection for 9-23-08.jpg.
226 Transfer complete.
PORT 192,168,1,230,192,234
200 PORT command successful.
STOR 9-23-06.jpg
150 Opening BINARY mode data connection for 9-23-06.jpg.
226 Transfer complete.
PORT 192,168,1,230,192,235
200 PORT command successful.
  etc.

the latter is also much, much faster! Or, does one have to write his 
own socket for this? Rather not go there if i don't have to....although 
i think I have some old scripts that might work... but I am a bit 
spoiled now with the ease of the new library ;-)

Sannyasin Sivakatirswami
Himalayan Academy Publications
at Kauai's Hindu Monastery
katir at hindu.org

www.HimalayanAcademy.com,
www.HinduismToday.com
www.Gurudeva.org
www.Hindu.org




More information about the use-livecode mailing list