Catch interrupted signals (in select) in the threading handler. In addition, use the socket_error_handling context manager in connect loop to raise nicer exceptions