Random timeouts - WeOnlyDo Discussion board

Random timeouts (General questions)

by bruinman, Thursday, January 25, 2007, 19:23 (6512 days ago)

I am getting random timeouts in my application. Here is some of my code:
OptimLogger.Info( Trying to connect OPTIM 9000. );
Ssh1 = new WeOnlyDo.Client.SSH();
Ssh1.Timeout = 300;
Ssh1.Hostname = strHostName.ToString(); //my host
Ssh1.Login = strUserName.ToString(); //mylogin
Ssh1.Password = strPassword.ToString(); //mypassword
Ssh1.Blocking = true;
Ssh1.Protocol = WeOnlyDo.Client.SSH.SupportedProtocols.SSHAuto;
Ssh1.Connect();

Then I have multiple instances (imagine the code below multiplied many times) where I have to do the following:

strExp = Please Enter Choice : ;
strCmdOutput = Ssh1.Execute( 3
, regex: [/(Please)( )(Enter)( )(Choice)( )(:)( )(0)/] );
Ssh1.WaitFor(strExp);
output = Ssh1.Receive();

whenever I hit the waitfor statement, the application times out at DIFFERENT places. If i run the application directly, there are no conflicts or timeouts. Any ideas what could be wrong or how to troubleshoot?

I am using WeOnlyDo.Client.SSH, Version=2.1.6.23

Re: Random timeouts

by woddrazen, Thursday, January 25, 2007, 21:09 (6512 days ago) @ bruinman

Hi,


Please try something like this:
[code]
Ssh1.Connect();
strExp = Please Enter Choice : ;
Ssh1.WaitFor(strExp);
console.write(Ssh1.Execute( 3rn , regex: [/(Please)( )(Enter)( )(Choice)( )(:) ( )(0)/] ));
[/code]

After you successfully connects to server and before you executing some command using Execute Method you must wait for a prompt.You can use for that WaitFor Method.
After Execute Method is done you don't have to call Receive Method because Execute Method will show you result.

Hope this helps.


Regards,
Drazen