Re: Reusing connections for multiple commands - WeOnlyDo Discussion board

Re: Reusing connections for multiple commands (General questions)

by jdlogicman, Wednesday, April 06, 2011, 18:39 (4980 days ago) @ woddrazen

When I try that sample code (adapted), I get an exception calling Connect() that the Prompt field is not set. It's sort of a chicken-and-egg problem, where it's not always possible to know what the prompt will be unless you set it yourself.

_ssh = new WeOnlyDo.Client.SSH();
_ssh.Hostname = _host;
_ssh.Login = _user;
_ssh.Password = _password;
_ssh.Protocol = WeOnlyDo.Client.SSH.SupportedProtocols.SSHAuto;
_ssh.TerminalType = tty ;
_ssh.Blocking = true;
_ssh.LicenseKey = xxxxxx ;
_ssh.Connect();

Hi,


Yes, you can send multiple command in non blocking mode using PromptReceived Event.

Here is example:
http://www.weonlydo.com/code.asp?did=Send-multiple-commands-to-SSH-server-using-asynchronous-connection

if you prefer to use blocking mode, then you can use WaitFor and Execute Method to send multiple command.

Here is blocking sample:
http://www.weonlydo.com/code.asp?did=Send-multiple-commands-to-SSH-server-using-synchronous-connection

Let us know how it goes.


Regards,
Drazen


Complete thread: