Can we declare the number of channels that can be used via single connection object?
the way we use it is :
var connectionInfo = new PasswordConnectionInfo(strServerIP, strUsername, strPassword);
Failed to open a channel after 10 attempts
The block that is used for multithreading is:
Best Regards,
Kayhan YÜKSEL
the way we use it is :
var connectionInfo = new PasswordConnectionInfo(strServerIP, strUsername, strPassword);
connectionInfo.Timeout = TimeSpan.FromSeconds(30);
using (var client = new SshClient(connectionInfo))
{
client.Connect();
İf we try to open more than 10 threads , the error :
Failed to open a channel after 10 attempts
The block that is used for multithreading is:
//global count
foreach (string key in CmdGenerators.Keys)
{
textBox1.Text = textBox1.Text + "\r\n[" + DateTime.Now + "] Entry point for thread : " + key;
SshCommands[key] = client.CreateCommand(CmdGenerators[key].ToString()); // Perform long running task
AsyncResults[key] = SshCommands[key].BeginExecute(delegate(IAsyncResult ar)
{
Boolean temp = true;
}, null);
}
//set flag to control the state of the async processes
//int totalFinished = 0;
List<string> FinishedKeys = new List<string>();
while (FinishedKeys.Count() != AsyncResults.Count())
//while (AsyncResults.Count() != 0)
{
foreach (string key in AsyncResults.Keys)
{
if (FinishedKeys.Any(key.Contains) == false)
{
if (AsyncResults[key].IsCompleted)
{
FinishedKeys.Add(key.ToString());
SshCommands[key].EndExecute(AsyncResults[key]);
SshCommands[key].Dispose();
textBox1.Text = textBox1.Text + "\r\n GENERATED SQL FOR " + key;
}
}
}
}
//close client conn and dispose
client.Disconnect();
client.Dispose();
Thank you for your concern, Best Regards,
Kayhan YÜKSEL