Hi. I try to write simple ssh client for windows phone. So, I have a trouble.
Best Regards, Max Zhukov.
public string ExecuteCommandByShell(string command)
{
ShellStream stream = _sshClient.CreateShellStream("xterm", 80, 24, 800, 600, 1024);
StreamReader reader = new StreamReader(stream);
StreamWriter writer = new StreamWriter(stream);
writer.AutoFlush = true;
while (stream.Length == 0)
{
Thread.Sleep(500);
}
string text = reader.ReadToEnd();
writer.WriteLine(command);
text = reader.ReadToEnd();
return text;
}
I want to execute command from param of function on remote computer via ssh. If I do it by
public string ExecuteCommand(string command)
{
var commandResult = _sshClient.RunCommand(command);
return commandResult.Result;
}
it'll be okay, but it isn't good way for my task. Can you tell me, what's wrong?Best Regards, Max Zhukov.