IsConnected does not accurately reflect connection status?

May 29, 2013 at 9:26 PM
Hey folks,

I have an odd issue and I'm trying to figure out if this is a bug or I'm just doing things wrong. I have code that opens a connection , writes a line to a ShellStream, and then monitors the output of the stream.

If I power off the host I'm connected to while I sit in a while loop waiting for stream data, no exception is thrown. Also sshClient.IsConnected reports true even though we (should) have lost connection with the server. It seems the sshclient object never becomes notified of the disconnect. Anyone know what I'm missing here? Thanks very much in advance

sshClient = new SshClient("ip", "user", "pass");

ShellStream stream = sshClient.CreateShellStream("MyStream", 600, 400, 800, 600, 100);

bool keepReading = true;

while (keepReading && _sshClient.IsConnected)
// Some code to parse the output