Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: Multiple Connection (Sessions) or Multiple Command control

$
0
0
Hello,

I have currently the problem, that I can't connect multiple times like with putty.
SshClient ssh;


public void Check(dynamic Parameters)
        {

             ssh = new SshClient("server", 888, "root", "pw");
             ssh.Connect();
             
            var cmd = ssh.CreateCommand("ulimit -t 3600");
            cmd.BeginExecute();

            string command = "Parameters[2].ToString()";
            cmd = ssh.CreateCommand(command);
            cmd.BeginExecute();

           ... code continues....
       }
Check is a Thread that will be started multipletimes, but I just can run 1x the commands above, when the second thread starts, it does nothing.

Or if you recommend me Multiple commands then I need a 100% controll over the commands that are executed, so when 3 commands in 3 Threads are executed, when something happen, like "check" say Command 2 should be closed, that he end that.


Parameters[2] is a command, that will start a script on my Server, that is executed +- 1hour and should be interrupted when something happen

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>