This project is read-only.

A question re: activity & timeout...

Nov 22, 2013 at 6:17 PM
Experts,

I am trying to figure out how to capture commands' output from routers, switches & servers that respond with a lot on the command line. Like cat'ing a large text file, or a running-config, etc.

Right now, I try to estimate the timeout duration in seconds, but this isn't a reliable way. What I really need is a way to:
  1. fill a variable with the results of command line entry on the host (not using SshCommand, as it wasn't reliable [the way I was doing it])...
  2. wait for activity on the stream to stop for, say, X seconds.
I have tried .Expect(), but again, it is not reliable when using stream (2 handles, in & out, on the same ssh object).

So think of it like another kind of timeout: One that will assume that any data coming in (except the echo'ing back on the stream of the command entered from the client) is good, and somehow maybe monitor ReadLine() or some such to start counting every time a line is read.

If another line of data is read, restart the timer. If this goes on and the timer reaches a threshold (user set), then the stream somehow signals it is done, and the string variable is then assumed to have all the text returned from the command.

Right now the existing timeout() will cut off the stream returned from the server-even if there is still data being written to it.

How do you all solve this?

TIA!

pat
:)

P.S. Thanks, Oleg for keeping this active. I hope to find a way to contribute.