Re: Buffer Size Command Hanging - WeOnlyDo Discussion board

Re: Buffer Size Command Hanging (General questions)

by wodSupport, Wednesday, July 08, 2009, 15:10 (5400 days ago) @ mmorton

Excellent! Here's mine too in case someone else follows this thread. It takes same time as in ActiveX: [code] static void Main(string[] args)
{
WeOnlyDo.Client.SSH ssh = new WeOnlyDo.Client.SSH();
ssh.Hostname = ******** ;
ssh.Login = ******** ;
ssh.Password = ******** ;
ssh.Blocking = true;
ssh.Connect();

String prompt = kreso@linux ;

// wait for initial prompt
ssh.WaitFor(prompt);
ssh.DataReady = 0;

// send command
ssh.Send( ls -alR /usr
);

String lastline = String.Empty; // this is only thing to test
String totaldata = String.Empty; // this is all between the command and prompt
int i;
do
{
lastline += ssh.Receive();

// remove all lines to buffer
do
{
i = lastline.LastIndexOf('
');
if (i >= 0)
{
totaldata += lastline.Substring(0, i+1);
lastline = lastline.Substring(i + 1);
}
} while (i >= 0);

// check lastline for prompt
i = lastline.IndexOf(prompt);
if (i >= 0)
{
// add existing data to totaldata
totaldata += lastline.Substring(0, i);
lastline = lastline.Substring(i + 1);
break;
}
} while (true);

Console.WriteLine(totaldata);
}
}
[/code]


Complete thread: