WinSCP AddRawSettings FSProtocol

1.7k Views Asked by At

When generating the C# code from the WinSCP GUI, I get

sessionOptions.AddRawSettings("FSProtocol", "2");

Does anyone know what this FSProtocol setting and the value "2" means? I tried to google "FSProtocol" but fail to get any result specific to it.

Here's a setting list I found from their doc https://winscp.net/eng/docs/rawsettings

2

There are 2 best solutions below

1
On

WinSCP helpfully has source code in GitHub (and other places too) - a search in that repo for FSProtocol found this line, which nicely lists the names associated with each value - they seem to refer to the different file transfer modes of WinSCP:

https://github.com/winscp/winscp/blob/c472858e482cbdee0508c64203bc58340b645007/source/core/SessionData.cpp#L48

0: SCP
1: SFTP (SCP) 
2: SFTP
3: ???
4: ???
5: FTP
6: WebDAV
7: S3
1
On

As @Jason correctly answered, FSProtocol specifies the protocol to use. But in WinSCP .NET assembly that is already specified by SessionOptions.Protocol property. So this does not explain, why the FSProtocol is needed in your generated code.

The only case out of the protocol list that cannot be covered by SessionOptions.Protocol is the 2, what is SFTP protocol with fallback to SCP disabled. WinSCP by default falls back to SCP protocol, in case the server does not support SFTP. You must have disabled the fallback in GUI. So the GUI needed to use FSProtocol to reflect that non-default settings.

Unless you really wanted the fallback disabled, you can safely remove your SessionOptions.AddRawSettings call.