Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: IsConnected does not accurately reflect connection status?

$
0
0
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");
sshClient.Connect();

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

bool keepReading = true;

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

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>