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

New Post: Problem to receive SshCommand.Execute() response

$
0
0
Hi, I call SshCommand.Execute() method a lot of times to copy files on a linux system. I am communicating with 3-5 hosts at the same time and sometimes SshCommand.Execute() hangs for some of the threads. When one thread is finished the Execute method response is received for one of the other threads.
      public void RunCmd(string ip, string user, string password, string command)
        {
            using (Renci.SshNet.SshClient client = new Renci.SshNet.SshClient(ip, user, password))
            {
                client.Connect();
                if (client.IsConnected)
                {
                    SshCommand cmd = client.CreateCommand(command);
                    result = cmd.Execute(command);
                }
            }
        }

Viewing all articles
Browse latest Browse all 1729

Trending Articles