Great. I think lowering the keepalives interval *does* work. I lowered it to 10 secs and it seems to be keeping the connection (I'm using FTP). I had tried switching to passive mode, and thought that was working, but in fact I still got a disconnection after a while. I'm testing this in WinSCP itself.
So, now how do I set keepalives from a script (which is the only place I would find it useful to use "keepuptodate")? I note that the open command has the following switches:
-privatekey=<key> Private key path
-timeout=<sec> Server response timeout
-hostkey=<fingerprint> Specifies fingerprint of expected host key.
-passive Passive mode (FTP protocol only)
Unfortunately, no keepalives switch. Any chance of this being added? From a site search, I note that there was a similar request about two weeks ago, but no resolution or answer.
Edit: I just discovered https://winscp.net/eng/docs/commandline.
Can I use the following to do what I want:
winscp.exe [session] /keepuptodate [local_directory] [remote_directory] [/defaults]
Do I understand correctly that the "keepalives" setting would come from the stored session, so I can set it to what I require to keep my connection alive when invoked as above? With this, would I be able to invoke it as a background task e.g. on login, as I would require?