Contents
We had this question come up in our Forums: Is it better to call net.sftp.init{}
at the beginning of the main.lua file (so that it is only executed on channel start), or inside of main()
?
The simple answer is that it makes very little difference. The net.sftp.init{}
call simply caches the connection parameters, a separate connection is then opened and closed for each subsequent SFTP command.
There is a minor performance overhead depending on where the call is placed. When the call is outside main()
it is only called once when the channel is started, if it is inside it is inside main()
then it is called for each message, which is a marginally greater overhead.
Note: The same thing applies for net.ftp.init{}
and net.ftps.init{}
.
Please contact support at support@interfaceware.com if you need more help.