Re: Timeout occurred due to inactivity when I exec - WeOnlyDo Discussion board

Re: Timeout occurred due to inactivity when I exec (General questions)

by sajjad, Friday, March 20, 2009, 08:24 (5488 days ago) @ woddrazen

Hi,

I am still unable to execute the command. I made changes in code as per according to your suggestion but it doesn't work. My application halt at 'waitfor' condition.

Following is my code:

private void button3_Click(object sender, EventArgs e)
{
Ssh1.Login = TextBox3.Text;
Ssh1.Password = TextBox4.Text;
Ssh1.Encryption = WeOnlyDo.Client.SSH.EncryptionMethods.Auto;
Ssh1.Protocol = WeOnlyDo.Client.SSH.SupportedProtocols.SSHAuto;
Ssh1.Port = 22;
Ssh1.Blocking = true;
Ssh1.Timeout = 40;
Ssh1.Connect(TextBox2.Text);
Ssh1.WaitFor(@ regex:[$ #>] $ );
Ssh1.Execute( cd /tmp
, @ regex:[$ #>]$ );
}

I tried many other option as it is mentioned in the help manual, but it do not work.. :(

Hi Sajjad,


Can you please move your code from Connected Event just after Connect Method. You are using blocking mode and commands are executed line by line so you don't need Events.

Also please remove Prompt Property because you don't need it if you are using WaitFor Method.

If you still receive error on WaitFor line please change it to this:
[code]Ssh1.WaitFor( regex:[\$ #>] $ )[/code]
When using Execute Method you should add second prompt parameter also and send (
or
) sequence at the end of your command.

Something like this:
[code]Console.Write(Ssh1.Execute( cd /tmp
, regex:[\$ #>]$ ));[/code]
More help fro Execute Method you can find here:
http://www.weonlydo.com/SSH.NET/Help/WeOnlyDo.Client.SSH.Execute_overload_2.html

Let us know how it goes.


Regards,
Drazen


Complete thread: