try and handle broken pipes when a TCP server goes away and reconnect