correct timeout code to work in presence of stalled server

with the 'retry n times' method, a stalling or downed
server could have easily taken the client down for quite awhile.