在阅读SSH答案方面有一些帮助(我是初学者...) [英] some help with reading SSH answer (I'm a starter....)
问题描述
你好,
我是c#的新手,我想编写一个在ssh连接到我的设备的代码,以发送命令并保存重播.
I'm new at c# and I want to write a code that connect to my device at ssh send a command and save the replay.
这是我到目前为止所拥有的
this is what I have so far
using Renci.SshNet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Net.NetworkInformation;
using System.IO;
using System.Net.Sockets;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
using (var client = new SshClient("10.0.0.111", "admin", "admin"))
{
Console.WriteLine("SSH Test 1");
client.Connect();
client.RunCommand("/beep");
client.RunCommand(":put 123");
// string temp = Console.ReadLine();
string answer = client.Read();????????
client.Disconnect();
Console.WriteLine("Press any key to leave ");
Console.ReadKey(); //end of program - any key to close it
}
}
}
}
推荐答案
嗨Koren1234,
Hi Koren1234,
谢谢您在这里发布.
For your question, you could download the source file from SSH.NET is a Secure Shell (SSH) library for .NET, optimized for parallelism.
并从 SSH.NET-develop \ SSH.NET-develop \ src \引用文件Renci.SshNet \ SshClient.cs.该程序中包含有关如何连接SSH和输出流的详细信息.
And refer to the file from SSH.NET-develop\SSH.NET-develop\src\Renci.SshNet\SshClient.cs. In the program, it has details about how to connect to SSH and the output stream.
If you have some else about the SSH, you could post a new thread in SSH.NET. The experts of SSH.NET would give you a solution.
最好的问候,
温迪
这篇关于在阅读SSH答案方面有一些帮助(我是初学者...)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!