FTP multiple files via a single socket connection

Dave Cragg dcragg at lacscentre.co.uk
Wed Sep 24 03:39:00 EDT 2003


At 7:07 pm -1000 23/9/03, Sannyasin Sivakatirswami wrote:

>
>  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:

Just to clear up what liburl does. It uses a single "control" socket 
for a series of tranfers (by default on port 21). However, a separate 
"data transfer" socket is used for each file transfer. In Active 
mode, libUrl opens the data transfer socket on the local machine, and 
it increments the port number by 1 for each file transfer. This is 
normal, and your Interarchy log below shows the same behavior. (The 
final number on the PORT line indicates a new port number for each 
transfer.)

>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.

However, the log you sent off the list was for Passive transfer, and 
it showed the same port being used for a series of data transfers in 
Interarchy but not with libUrl. I'm not sure why, but I think it's 
normal in passive mode too for the data transfer port to be 
incremented for successive file transfers.

>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 ;-)

I'm sure the Interarchy people invest some time in making ftp data 
transfers go fast. I'd expect that from a dedicated FTP client. My 
goal for libUrl is "fast enough". :) (But all optimization tips are 
welcome.)

Cheers
Dave




More information about the use-livecode mailing list