Host is not communicating for 15 seconds

Advertisement

rgaetan
Joined:
Posts:
16
Location:
Decatur, IL

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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Host is not communicating for 15 seconds

Using SessionOptions.Timeout is the right way.

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

martin
Site Admin
martin avatar

Re: Host is not communicating for 15 seconds

OK, as I wrote before, you need to use SessionOptions.Timeout. You are setting Session.Timeout.

Reply with quote

Advertisement

rgaetan

Re: Host is not communicating for 15 seconds

Just saw that in the code ... switching and retrying. Will get back on issue with VAX after I resolve this one ... stand by

Reply with quote

rgaetan

Re: Host is not communicating for 15 seconds

I think I see my confusion. In Session Properties, it says "Maximal interval between two consecutive outputs from WinSCP console session, before TimeoutException is thrown. The default is one minute." In SessionOptions Properties, it says "Server response timeout. Defaults to 15 seconds." I'm now using it in both Session and SessionOptions just in case.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Host is not communicating for 15 seconds

rgaetan wrote:

I think I see my confusion. In Session Properties, it says "Maximal interval between two consecutive outputs from WinSCP console session, before TimeoutException is thrown. The default is one minute." In SessionOptions Properties, it says "Server response timeout. Defaults to 15 seconds." I'm now using it in both Session and SessionOptions just in case.
I have updated documentation of Session.Timeout to make it clear, one should hardly ever want to set it.
https://winscp.net/eng/docs/library_session

Reply with quote

Advertisement

You can post new topics in this forum