0 votes
by (170 points)

I am sending commands to servers via ssh-> scripting object. During initialization, I set both ssh and scripting timeout values, however I receive "The operation was not completed within the specified time limit." error although the time passed is less than the value I specified for timeout.

Code snippet I set timeout values:

            ssh.Connect(ip);
            ssh.Login(user, pass);

            ///set scripting timeout to 1000mins
            ssh.Timeout = 60000000;

            //start scripting
            scripting = ssh.StartScripting();

            //set scripting timeout to 240 mins
            scripting.Timeout = 14400000;

Code snippet I send commmands:

                scripting.SendCommand(" validate");

                //this is where I get exception
                scripting.WaitFor(ScriptEvent.FromString(")>"));

Below is rebex log in debug mode:

2016-03-17 11:08:15.612 DEBUG Ssh(3)[19] Info: Sent 10 bytes of data.
2016-03-17 11:08:15.612 DEBUG VirtualTerminal(0)[19] Scripting: WaitFor(Line)
2016-03-17 11:08:15.616 DEBUG Ssh(3)[19] Info: Received 11 bytes of data.
2016-03-17 11:08:15.616 DEBUG VirtualTerminal(0)[19] Scripting: WaitFor(received text: ')>')
2016-03-17 11:08:15.754 DEBUG Ssh(4)[25] Info: Sent 10 bytes of data.
2016-03-17 11:08:15.755 DEBUG VirtualTerminal(0)[25] Scripting: WaitFor(Line)
2016-03-17 11:08:15.756 DEBUG Ssh(4)[25] Info: Received 9 bytes of data.
2016-03-17 11:08:15.757 DEBUG Ssh(4)[25] Info: Received 2 bytes of data.
2016-03-17 11:08:15.757 DEBUG VirtualTerminal(0)[25] Scripting: WaitFor(received text: ')>')
2016-03-17 11:08:15.760 DEBUG Ssh(5)[26] Info: Sent 10 bytes of data.
2016-03-17 11:08:15.760 DEBUG VirtualTerminal(0)[26] Scripting: WaitFor(Line)
2016-03-17 11:08:15.762 DEBUG Ssh(5)[26] Info: Received 11 bytes of data.
2016-03-17 11:08:15.762 DEBUG VirtualTerminal(0)[26] Scripting: WaitFor(received text: ')>')
2016-03-17 11:09:20.391 ERROR Ssh(3)[19] SSH: Rebex.Net.SshException: The operation was not completed within the specified time limit.
at Rebex.Net.SshSession.TL()
at Rebex.Net.SshChannel.FC(Int32 A, SocketSelectMode B)
2016-03-17 11:09:20.527 ERROR Ssh(5)[26] SSH: Rebex.Net.SshException: The operation was not completed within the specified time limit.
at Rebex.Net.SshSession.TL()
at Rebex.Net.SshChannel.FC(Int32 A, SocketSelectMode B)
2016-03-17 11:09:22.064 ERROR Ssh(4)[25] SSH: Rebex.Net.SshException: The operation was not completed within the specified time limit.
at Rebex.Net.SshSession.TL()
at Rebex.Net.SshChannel.FC(Int32 A, SocketSelectMode B)

1 Answer

0 votes
by (15.2k points)
edited by

Update: This issue has been solved in Rebex Terminal Emulation 2016 R2.


You set the ssh.Timeout too late. Please set ssh.Timeout before connecting to the server.

//set SSH timeout to 1000 minutes
ssh.Timeout = 1000*60*1000;
ssh.Connect(ip);
ssh.Login(user, pass);

//start scripting
scripting = ssh.StartScripting();
//set scripting timeout to 240 minutes
scripting.Timeout = 240*60*1000;

Ssh.Timeout is used for data transfer over the net. So if you have slow connection, you set ssh.Timeout to greater values. Scripting.Timeout is used for “scripting” methods. So, when you wait for a string in a very long response and it is not received yet, you can get scripting.Timeout even though data are receiving very fast and continuously. Obviously, you can get the scripting.Timeout when no data are received, like the string was not present in received response.

by (170 points)
Hi Pavel,

This solves my problem. Thanks again for your reply.
...