Salut tout le monde,

J'ai un petit problème, je veux me connecter à un appareil et donner des commandes de SSH avec C#.
J'ai réussi à écrire le code mais le problème ici :

Nom : pro2.PNG
Affichages : 496
Taille : 5,2 Ko

quand je start mon programme, il s'arrête toujours à la ligne 32 (Console.Write("SSH ist verbunden ");//ssh is connected). Avez-vous une idée comment résoudre ce problème ?
merci beaucoup et désolé pour mon français
Nom : pro1.PNG
Affichages : 630
Taille : 42,0 Ko

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
public static void Main(string[] args)
        {
 
            //Connection information
 
 
            String IP = "";
            //int Port = ;
            String SCM = "";
            String Scmpass = "";
 
            //Set up the SSH connection
            using (var client = new SshClient(IP, ****, SCM, ****))
            {
 
                //Start the connection 
                client.Connect();
32------------->>>>>>>>  Console.Write("SSH ist verbunden ");//ssh is connected
                Console.WriteLine();
                //client.RunCommand("su -");
                SshCommand sc = client.CreateCommand(string.Format("su -"));
                sc.Execute();
                Console.Write(sc.Result );
                Console.Write("su command ist abgegeben  ");
                Console.WriteLine();
                client.KeepAliveInterval = new TimeSpan(0, 0, 5);
 
 
                Console.Write("Root Passwort: ");
                String Rootpass = Console.ReadLine();
                SshCommand rootpass = client.CreateCommand(Rootpass);
                rootpass.Execute();
                client.KeepAliveInterval = new TimeSpan(0, 0, 3);