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

New Post: Hanging indefinitely while trying to write to the stream

$
0
0
If written some threaded code that makes use of this library. A simplified version of my code looks like this:
while (!stopThread)
{
    if ([there is new input])
    {
        ShellStream.WriteLine(newInput);

        output = ShellStream.Expect(regex prompt, timeout);

        AddOutputToOutputQueue(output);

    }
}
During testing, I've discovered that if I establish a connection, then disconnect my network cable (because network dropouts are a real possibility for the application I'm making), this code hangs indefinitely at the ShellStream.WriteLine method. At always straight away, I'll sometimes get a couple of null outputs first, but eventually it just hangs.

I know that ShellStream has a way of setting a write timeout, but I get a "this stream does not support timeouts" message if I try that.

I've debugged using the SSH.Net code, and I see that an SshConnectionException is thrown, and objects start trying to Dispose. The point at which it gets stuck is in Session.cs, at line 673: "_messageListenerCompleted.WaitOne();"

Is there a solution to this?

Viewing all articles
Browse latest Browse all 1729

Trending Articles



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