Sorry, I was off on another project for a bit. Trying a different tack now. Let me see if this better illustrates what I'm trying to accomplish and if you can offer any further assistance from this.
SshShell shell = new SshShell("<host>", "<user>", "<pass>"); shell.RemoveTerminalEmulationCharacters = true;//This statement must be prior to connecting//shell.RedirectToConsole(); Console.Write("Connecting..."); shell.Connect(); Console.WriteLine("OK"); MemoryStream stream = new MemoryStream(); shell.SetStream(stream); StreamWriter command = new StreamWriter(stream); command.WriteLine("ll"); command.Flush();//stream.Position=0; StreamReader response = new StreamReader(stream); Console.WriteLine(response.ReadToEnd());//stream.Position = 0; command.WriteLine("exit"); command.Flush();//stream.Position = 0; response = null; command = null; stream.Close(); stream.Dispose(); stream = null; shell.SetStream(null);//while(shell.ShellOpened)//{// System.Threading.Thread.Sleep(500);//} Console.Write("Disconnecting..."); shell.Close(); Console.WriteLine("OK");
Thanks,
Michael