Re: How to catch error (or exit) when Receive hang - WeOnlyDo Discussion board

Re: How to catch error (or exit) when Receive hang (General questions)

by novanstar, Thursday, November 06, 2008, 19:39 (5622 days ago) @ wodDamir

Novanstar,

But you can use WaitFor method just for that purpose. Let's say that you start iperf on linux OS. It will wait until aborted by CTRL-C .

In that case, you can specify any prompt in WaitFor call, which will ofcourse timeout. But when that happens, you simply catch the error and call Receive method (or Peek) which will receive the data that was left in buffer (since WaitFor won't remove it).

When data is received, the code will proceed, and now you can send CTRL-C , which proceeds with accepting prompt.

Ofcourse, in this case, a global Timeout property has to be set to a value higher then the timeout parameter in WaitFor call.

Hope this helps.

Regards,
Damba

Dear WEONLYDO support team,
That works! Thanks for all your great and instant support. I will proceed to place an order of this software. :)

The only thing left is that if there is any way I can supress the error printout in Perl:
===== error msg =====
OLE exception from WeOnlyDo.wodSSHCom.1 :
The current connection has timeout.

Win32::OLE(0.1707) error 0x800a05b4
in METHOD/PROPERTYGET WaitFor ....
=====================

Thanks,
novanstar


Complete thread: