support for timeout and reconnect