Don't use a long timeout. Instead, use a short timeout (100-1000 ms), and use a shift register to count the number of consecutive timeout errors. Once this is larger than a certain number, abort the connection. If there was no error, reset the counter.
___________________
Try to take over the world!