Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: A Little Help With Connection Settings

$
0
0

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


Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>