Host is not communicating for 15 seconds
I'm using VisualBasic .NET to write a patching application. WinSCP version is 5.5.2 Build 4130. Code running on Windows 7 64-bit. Code sends a command from Windows to Linux for a patching program to run on Linux and waits for job completion. Patch apply/download time may be greater than 15 seconds. If it is, code aborts due to timeout. I've tried sendbuf = 0, sendbuf = 262144, .Timeout = 2 hr value. I still get timeouts after 15 seconds of inactivity while waiting for patch or downloads to happen and my process abends. Help ... here's the code:
Dim SessionOptions As New SessionOptions ' SCP configuration options
Dim Session As Session = New Session ' Linux connection config options
Dim Timer As New TimeSpan(2, 0, 0) ' Session Timeout interval setting: 2 hr, 0 min, 0 sec
With SessionOptions ' Set up session options
.AddRawSettings("PingType", "2") ' Send execute dummy protocol cmnds
.AddRawSettings("SendBuf", "0") ' Optimize connect buffer size
.AddRawSettings("SshProt", "3") ' Preferred SSH version: SSH-2 only
.AddRawSettings("Shell", "bash") ' SCP protocol: "bash"
.GiveUpSecurityAndAcceptAnySshHostKey = True ' Accept any SSH host key
.HostName = Buf(2) ' Hostname's IP address is in var
.Password = Pwd ' Provide decrypted password
.PortNumber = 22 ' Assign SSH channel 22
.Protocol = WinSCP.Protocol.Scp ' Assign SCP protocol
.UserName = ProxyUsr ' Provide username
End With ' SessionOptions
With Session ' Execute statements
.DisableVersionCheck = False ' Don't check lib against DLL
.DebugLogPath = Path & "Debug\" & Buf(1) & ".log" ' Set session debug path
.ExecutablePath = Path1 & "WinSCP.exe" ' Set path to SCP program
.IniFilePath = Path1 & "WinSCP.ini" ' Set path to INI file
.SessionLogPath = Path & "Session\" & Buf(1) & ".log" ' Set session transaction log path
.Timeout = Timer ' Set session timeout to two hours
.Open(SessionOptions) ' Call Linux through SCP
Cmd = "./update.sh" ' Command to execute
Str = (.ExecuteCommand(Cmd).Output).Replace(Chr(10), Chr(13) & Chr(10)) ' Linux/VAX execute
OutFile.WriteLine(Str) ' Dump exec returned text to file
Console.WriteLine(Str) ' Dump exec text returned to screen
End With ' Session
Dim SessionOptions As New SessionOptions ' SCP configuration options
Dim Session As Session = New Session ' Linux connection config options
Dim Timer As New TimeSpan(2, 0, 0) ' Session Timeout interval setting: 2 hr, 0 min, 0 sec
With SessionOptions ' Set up session options
.AddRawSettings("PingType", "2") ' Send execute dummy protocol cmnds
.AddRawSettings("SendBuf", "0") ' Optimize connect buffer size
.AddRawSettings("SshProt", "3") ' Preferred SSH version: SSH-2 only
.AddRawSettings("Shell", "bash") ' SCP protocol: "bash"
.GiveUpSecurityAndAcceptAnySshHostKey = True ' Accept any SSH host key
.HostName = Buf(2) ' Hostname's IP address is in var
.Password = Pwd ' Provide decrypted password
.PortNumber = 22 ' Assign SSH channel 22
.Protocol = WinSCP.Protocol.Scp ' Assign SCP protocol
.UserName = ProxyUsr ' Provide username
End With ' SessionOptions
With Session ' Execute statements
.DisableVersionCheck = False ' Don't check lib against DLL
.DebugLogPath = Path & "Debug\" & Buf(1) & ".log" ' Set session debug path
.ExecutablePath = Path1 & "WinSCP.exe" ' Set path to SCP program
.IniFilePath = Path1 & "WinSCP.ini" ' Set path to INI file
.SessionLogPath = Path & "Session\" & Buf(1) & ".log" ' Set session transaction log path
.Timeout = Timer ' Set session timeout to two hours
.Open(SessionOptions) ' Call Linux through SCP
Cmd = "./update.sh" ' Command to execute
Str = (.ExecuteCommand(Cmd).Output).Replace(Chr(10), Chr(13) & Chr(10)) ' Linux/VAX execute
OutFile.WriteLine(Str) ' Dump exec returned text to file
Console.WriteLine(Str) ' Dump exec text returned to screen
End With ' Session