SSH.NET verarbeitet meine Shell -Eingabebefehle nicht

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: SSH.NET verarbeitet meine Shell -Eingabebefehle nicht

by Anonymous » 16 Apr 2025, 07:07

Ich verwende SSH.NET, um eine Verbindung zu meinem Raspberry Pi aus einer Konsolenanwendung in C#zu verbinden. Es ist wie bei der Writeline ("LS") keinen Effekt.

Code: Select all

using System;
using System.IO;
using Renci.SshNet;

class Program
{
static void Main(string[] args)
{

var ssh = new SshClient("raspberrypi", 22, "pi", "raspberry");
ssh.Connect();

var input = new MemoryStream();
var streamWriter = new StreamWriter(input) { AutoFlush = true };

var stdout = Console.OpenStandardOutput();
var shell = ssh.CreateShell(input, stdout, new MemoryStream());
shell.Start();

streamWriter.WriteLine("ls");

while (true)
{
}
}
}
Was ist das Problem?

Top