libUrlFtpUploadFile - reuse open sockets?

Phil Davis revdev at
Tue Apr 14 18:34:59 EDT 2009

Howdy -

While using libUrlFtpUploadFile to upload a bunch of files to a server, 
I find that libUrlFtpUploadFile opens a new socket for each upload. Even 
using a callback message to start a new one when the current one 
finishes, I get a "max number of connections" message back from the 
server when the server's max number is reached. After this, the next few 
upload attempts fail due to max number of connections; then as the open 
connections time out, new files can successfully upload again.

So... I want to know:

1) Does FTP require a new socket for each upload?

2) If not, how do I tell libUrlFtpUploadFile to reuse an existing open 
socket for the next upload?

3) Is there something else I'm missing? Am I making things more 
complicated than they need to be? I have a nagging suspicion along this 

Here's how my code is structured:

on uploadMyFile pLocalFile, pServerPath
  libUrlFtpUploadFile pLocalFile,pServerPath,"uploadEnded"
end uploadMyFile

on uploadEnded pUrl, pStatus
  put pUrl & tab & pStatus & cr after fld "callbackParams"
  put nextFileFromList() into p1
  put nextServerPath() into p2
  send ("uploadMyFile" && p1 & comma & p2) to me in 6 ticks
end uploadEnded

Many thanks for your help.
Phil Davis

PDS Labs
Professional Software Development

More information about the use-livecode mailing list