Re: Receive problem in SSH - WeOnlyDo Discussion board

Re: Receive problem in SSH (General questions)

by Jeff, Friday, January 13, 2006, 18:01 (6889 days ago) @ wodSupport

Kreso, I tried your sample against your server and it seems your SSH service is not running (I can ping the machine, but not connect using SSH client).

Anyway, testing locally using WaitFor() with regex:[\$ #>] $ as the first parameter (as you have) did not work - I am not regex guru but I thought it would find the DOS prompt ( > ). After I changed the first parameter to > it then gets data back ok.

But the bigger picture here is that I can't really use WaitFor() because the systems I am talking to sometimes do not return any sort of expected prompt in some cases - they could return error strings or messages indicating they are performing some task where I have to wait until I get data to know when it is done. There are too many cases to be covered by regex's.

So I was hoping to use Receive() with a small timeout, but if it times out then WODSSH will internally disconnect the session!! Is there any way to timeout without disconnecting, so I can call Receive() again.

And why does Peek() never return any data, and DataReady() always return 0? This doesn't make sense because if I then immediately do a call to Receive() it gets data.

It seems having the WODSSH object in the same thread as the main program does not really work as expected - it seems you need some sort of function that client code can call to tell the WODSSH object to process events (such as reading data into buffers, updating the data ready count, etc).

I have asked these questions in my previous posts but you did not address them - can you please give some insight?


Complete thread: