views:

333

answers:

3

Afternoon all,

I'm having a small problem with the SharpSSH library for .Net (see http://www.tamirgal.com/blog/page/SharpSSH.aspx)

        SshStream ssh = new SshStream("some ip address", "some username", "some password");
        ssh.Prompt = "\n";
        ssh.RemoveTerminalEmulationCharacters = true;            

        ssh.Write("ssh some ip address");
        // Don't care about this response
        ssh.ReadResponse();

        ssh.Write("lss /mnt/sata[1-4]");
        // Don't care about this response (for now)
        ssh.ReadResponse();

        // while the stream can be read
        while (ssh.CanRead)
        {
            Console.WriteLine(ssh.ReadResponse());
        }

        ssh.Close();

As you can see, it's fairly straight forward.

However, when the while-loop gets stepped into, it won't break out of the loop when everything has been printed to the console and there is nothing else to read.

Is there anyway I can manually force it to break when there is nothing else to be read?

Cheers, Ric

+2  A: 

ssh.CanRead indicates that Stream has implementation for Read, not that it can be read.

Alexander Shvetsov
A: 

Hi. Having the same problem you had. Did you find a solution?

syed
A: 

Hello, I am having the same issue. Were you able to find the solution. regards