SharpSSH - SSHExec,运行命令,并等待5秒钟的数据!

我有这个代码:
using System;
using System.Text;
using Tamir.SharpSsh;
using System.IO;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            SshExec exec = new SshExec("192.168.0.1", "admin", "haha");
            exec.Connect();
            string output = exec.RunCommand("interface wireless scan wlan1 duration=5");
            Console.WriteLine(output);
            exec.Close();
        }
    }
}
该命令将执行!我可以看到,但是!它立即打印数据。或者实际上,它不会从命令中打印数据。它打印像mikrotik os的徽标。我实际上需要来自命令的数据,我需要SharpSSH等待至少5秒钟的数据,然后把它还给我... 有人知道我怎么做到这一点? 我对此很新!我感谢所有的帮助!谢谢!     
已邀请:
您可能想尝试以下重载:
SshExec exec = new SshExec("192.168.0.1", "admin", "haha");
exec.Connect();
string stdOut = null;
string stdError = null;
exec.RunCommand("interface wireless scan wlan1 duration=5", ref stdOut, ref stdError);

Console.WriteLine(stdOut);
exec.Close();
如果他们的API符合名称的含义,那么它应该放置命令的标准输出 在stdOut中和stdError中的标准错误。 有关标准流的更多信息,请查看:http://en.wikipedia.org/wiki/Standard_streams     

要回复问题请先登录注册