| |||||||||||
Falt Tolerance for bad connections Posted by selfism (selfism), 9 February 2005 Hi all, I am attempting to verify if the commands I send are received correctly on the far end machine. To accomplish this I look for my command to be echoed back to me, in this way I know the remote machine received it perfectly. To test this I am purposely connecting to a remote system that has stty -echo in its bash_profile. My echoing test should fail and activate my "timeout" action. MY PROBLEM is that I keep looping on the "send human" action in my timeout action instead of moving to the next step in my timeout action. I tried removing the exp_continue but then the next command in the cmd_list is run rather than having my original command rerun. I suspect I have a problem with my logic but I am watermelon Tuesday . My code is as follows, any help would be REALLY appreciated! foreach cmd $cmd_list { set bad_echo "0" send -- "$cmd" expect { timeout { if {$bad_echo == 0} { set $bad_echo "1" set send_human {.1 .3 1 .05 2} send -h "$cmd" exp_continue } elseif {$bad_echo == 1} { set bad_echo "2" set send_slow {1 1} send -s "$cmd" exp_continue } else {$bad_echo == 3} { set report_file [open "$task_dir/report.txt" "WRONLY"] puts $report_file "Possible dirty connection to $host, simon says echoing won't work" continue } } eof { set report_file [open "$task_dir/report.txt" "WRONLY"] puts $report_file "Lost connection to $host" continue } -re "$cmd" { send -- "\r" } } #EOF expect loop expect -re "$prompt" } interact } # end of server foreach loop *****exp_internal info: [mux@Indestructible ~]$ send: sending "ps" to { exp9 } expect: does "" (spawn_id exp9) match regular expression "ps"? no expect: timed out send: sending "ps" to { exp9 human_write: avg_arr=0.100000/0.300000 1/shape=1.000000 min=0.0500 00 max=2.000000 } expect: continuing expect expect: does "" (spawn_id exp9) match regular expression "ps"? no expect: timed out send: sending "ps" to { exp9 human_write: avg_arr=0.100000/0.300000 1/shape=1.000000 min=0.0500 00 max=2.000000 } expect: continuing expect expect: does "" (spawn_id exp9) match regular expression "ps"? no expect: timed out send: sending "ps" to { exp9 human_write: avg_arr=0.100000/0.300000 1/shape=1.000000 min=0.0500 00 max=2.000000 } Posted by admin (Graham Ellis), 9 February 2005 I think thatset $bad_echo "1" should read set bad_echo "1" Posted by selfism (selfism), 10 February 2005 I am sorry for cluttering the boards with stupid oversights. I am not offended if you delete my postings.Thank you, it worked. Posted by admin (Graham Ellis), 10 February 2005 Don't worry about it - we all do things like that - Graham This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |