Sending a command SshClient, timeout?

Apr 11, 2015 at 3:42 PM
Edited Apr 11, 2015 at 3:44 PM
Hi I have got the SshClient to work fine.
But when I want to erase and reload a device it hangs and obviously will not reconnect as it has different credentials.
Is there a way to issue a command and disconnect as soon as the command is sent, or have a timeout of like 10 seconds, so if it cannot reconnect it goes to the next line

var command= client.RunCommand("reset");
command.Execute();

Thanks
Apr 14, 2015 at 3:51 PM
Edited Apr 14, 2015 at 3:52 PM
Something like this ?
 using (var client = new SshClient(host, username, password))
{
  client.Connect();
  client.RunCommand("reset");
  client.Disconnect();
 }