Forum OpenACS Q&A: login timing error - Disconnecting: Corrupted check bytes on input.

Hi,

I have an expect script that ssh into a list of routers.  SOmetimes, the script run smoothly, and other time it crashes with a mesg :
sh: /usr/local/bin/stty: not found
Disconnecting: Corrupted check bytes on input.
expect: spawn id exp50 not open
    while executing
"expect "#""
    ("while" body line 27)
    invoked from within
"while {[gets $file router] >= 0} {
    set rtr_len [string length $router]
    if {$rtr_len == 0} {
        continue
    }
    spawn ssh $login@$router  <---is where it fails.

Basically, as it tries to ssh into the router, and the router returns a prompt for a password.  I suspect that the timing of the return of the prompt varies, and if the script response doesn't match timely, then it knocks the script off. I also programmed a timeout clause, that detects and prints "connection timed out", then moves on to the next router, but it doesn't seem to kick in for this case.  It only kicks in when I run the script in a fast mode - only ssh into the router, do nothing, then get out, and ssh into the next router.  In slower mode, once logged into router, I run some commands and collect output.

Appreciate any comments.
-Julie