add retry for connecting to the server