Command Line posts large files, .NET fails
Someone else wrote a command line to put files to an SFTP server. I am trying to convert it to using the .NET library. For files under 2.5 GB, the .NET code works fine but bombs when I go over. The command line had no issue with a 4 GB file, so I don't understand what I'm missing in my conversion from the command line to the .NET.
The command line:
The .NET code
When I looked at the logs, the only thing I found different was that when I was sending the large file through the command line, the buffer grew to 2GB, but in the .NET, it stopped growing at 1GB (this is why I added the Raw Setting, to try to get the buffer to grow but it didn't look like it did anything).
Thoughts?
The command line:
winscp.com /command "open ftp://ftpuser:ftppwd@ftpserver -explicittls" "ascii" "call site sitecmd" "put localfile remotefile " "close" "exit"
SessionOptions SOt = new SessionOptions { Protocol = Protocol.Ftp, FtpSecure = FtpSecure.Explicit, HostName = "ftpserver", UserName = "ftpuser", Password = "ftppwd", Timeout = new TimeSpan(6, 0, 0) } SOt.AddRawSettings("SendBuf", "0"); using (WinSCP.Session Ses = new WinSCP.Session()) { Ses.SessionLogPath = @"c:\temp\log.txt"; Ses.Open(SOt); TransferOptions Trn = new TransferOptions(); Trn.TransferMode = TransferMode.Ascii; Ses.ExecuteCommand(sitecmd); TransferOperationResult TrnRes; TrnRes = Ses.PutFiles(localfile, remotefile, false, Trn); Trn.Check(); }
Thoughts?