# psuedo code alarm(someresonabletime) connect ; # blocks completely if you're prompted for PW # check error status and if SIG{ALARM} was called alarm(0) ; # disable pending alarm if( we got an EINTR or our SIG{ALARM} was called ) { broken ssh } ## ## Connected ##