I am using SharpSSH to send command from windows form to one of the linux machine. Everything is working as expected except that I am not able to update the output in real time. Output appears once the command execution is complete. How can I update the output as it happens.
Here is my code that runs as background worker.
private void execute_green_DoWork(object sender, DoWorkEventArgs e)
{
List<object> argumentList = e.Argument as List<object>;
string isp_username = (string)argumentList[0];
string isp_password = (string)argumentList[1];
string ssid = (string)argumentList[2];
string stdOut = null;
string stdError = null;
string address = "192.168.1.100";
string start = "Connecting...";
this.Invoke(new MethodInvoker(delegate { progressWindow.green_update(start); }));
System.Threading.Thread.Sleep(200);
string user = "user";
string pass = "password";
string status = "Connected.....";
this.Invoke(new MethodInvoker(delegate { progressWindow.green_update(status); }));
System.Threading.Thread.Sleep(200);
this.Invoke(new MethodInvoker(delegate { progressWindow.green_update("Programming....."); }));
SshExec ssh_green = new SshExec(address, user, pass);
ssh_green.Connect();
ssh_green.RunCommand("cfg_green " + isp_username + " " + isp_password + " " + ssid, ref stdOut, ref stdError);
output_green = stdOut;
ssh_green.Close();
In above the output_green is rendered to richtextbox. Someone with knowledge in SharpSSH , can you please guide me.