When I run a command like "show vlan" I always get the following before the results are shown (and not exactly as I typed it). I'm using SignalR btw.
ssh> show vlan
show
vlan
s
I just want to see the results of the command and not a jumbled display of the command. Here is a source snippet: shellStream = client.CreateShellStream(@"xterm", 80, 25, 640, 480, 1024);
SshSteams.GetOrAdd("foo", shellStream);
shellStream.DataReceived += StartAsyncRead;
shellStream.Write(command + "\n");
private void StartAsyncRead(object sender, EventArgs e)
{
ShellStream shellStream;
try
{
if (!SshSteams.TryGetValue("foo", out shellStream))
{
Clients.All.receive("ERROR: ShellStream object not found");
return;
}
shellStream.BeginRead(_data, 0, _data.Length, OnReadCompletion, new MyAsyncInfo(_data, shellStream));
}
catch (Exception)
{
throw;
}
}
private void OnReadCompletion(IAsyncResult ar)
{
SshClient client;
if (!SshClients.TryGetValue("foo", out client))
{
Clients.All.receive("ERROR: connection object not found");
return;
}
try
{
var mai = (MyAsyncInfo)ar.AsyncState;
int datalen = mai.Stream.EndRead(ar);
string line = client.ConnectionInfo.Encoding.GetString(mai.ByteArray, 0, datalen);
Clients.All.receive(line);
}
catch (Exception exception)
{
Clients.All.receive(exception);
}
}