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

How to catch error (or exit) when Receive hang (wodSSH / wodSSH.NET)

by novanstar, Tuesday, November 04, 2008, 02:57 (5865 days ago)

Dear support,
While working on a customized waitfor function, the script hang when there is no more result for Receive(). How can I resolve this issue?

==== code in Perl ====
for (;;) {
$buffer .= $ssh->Receive();
last if ($buffer =~ /match something/);
last if ((time - $time_start) > $timeout);
}
======================

If there is nothing matched, I expect it will break the loop after timeout. But it never breaks the loop because it got hang at Receive.

Thanks,
novanstar


Complete thread: