Broken Response in Asyncronous Connection - WeOnlyDo Discussion board

Broken Response in Asyncronous Connection (wodSSH / wodSSH.NET)

by Mike D, Thursday, December 11, 2014, 16:33 (1230 days ago)

I created a Putty simulator where the user types in ssh commands and gets the ssh response displayed to a textbox control. I am having a bit of trouble with the response. The commands sometimes echo back, as well the response will return scattered. The buffer will return in pieces and not in one line. For example:

ation Failed:

Is there any examples where the buffer is collected, until the prompt is received using the PromptReceived event?

The following what my code looks like so far.

void Init()
SshClient.ProxyType = SSH.ProxyTypes.ProxyWEBStandard;
SshClient.ProxyHostname = this.ProxyHostIpAddress;
SshClient.Login = this.DestinationUserName;
SshClient.Password = this.DestinationPassword;
SshClient.ProxyPort = 8989;
SshClient.Blocking = false;
SshClient.StripANSI = true;
SshClient.Protocol = SSH.SupportedProtocols.SSHAuto;
SshClient.Prompt = "regex:[\\$%#>] $";
SshClient.Timeout = 0;

SshClient.ConnectedEvent += new SSH.ConnectedDelegate(SshClient_ConnectedEvent);
SshClient.DisconnectedEvent += new SSH.DisconnectedDelegate(SshClient_DisconnectedEvent);
SshClient.DataReceivedEvent += new SSH.DataReceivedDelegate(SshClient_DataReceivedEvent);
SshClient.StateChangedEvent += new SSH.StateChangedDelegate(SshClient_StateChangedEvent);
SshClient.PromptReceivedEvent += SshClient_PromptReceivedEvent;

public void SendCommand(string command)
     if (IsConnectionValid())


void SshClient_PromptReceivedEvent(object Sender, EventArgs Args)

private void SshClient_DataReceivedEvent(object Sender, WeOnlyDo.Client.SSH.DataReceivedArgs Args)
                String sshResponse;

                sshResponse = SshClient.Receive();

                // replace LF with CRLF so it's shown properly in textbox
                sshResponse = sshResponse.Replace("\n", "\r\n");


Complete thread: