[Gambas-user] Can Gambas write directly from a String variable to a remote file via FTP?

Benoît Minisini g4mba5 at gmail.com
Sun Feb 18 19:45:39 CET 2018


Le 18/02/2018 à 08:16, Phan Damily via User a écrit :
> Thank you for the reply, Lee. Yes, ultimately my project will be 
> modifying hundreds of small files at a time, and sending to a remote 
> server.
> 
> I'm sorry to learn that there's not a way to avoid extra steps, 
> regardless of the method used. I've decided on having my Gambas project 
> create/mount a ram disk on Form_Open, write the modified String data to 
> a temp file on the ram disk, upload the temp file using the Put command, 
> and unmount the ram disk when I click the Exit button.
> 
> The upload of one tiny text file works flawlessly in tests, and seems 
> instantaneous. However, hundreds of files may be a different matter, as 
> I think FTP must close the connection and open a new one with each file 
> transfer (unless I'm mistaken). I'll look into sFTP, which my 
> understanding is it re-uses the same connection. This allows uploads to 
> be back-to-back, for much less overhead. I'm not sure if Gambas natively 
> supports sFTP but I'm looking into it.
> 
> Thanks again.
> 
No, you can keep the same FtpClient connection to send multiple files.

But be prepare: sometimes the FtpClient will return an error (FTP 
servers seem to have some sort of timeouts), and you have to reconnect 
to continue sending your files.

-- 
Benoît Minisini


More information about the User mailing list