tcp server, retry a couple of times until getting a tcp connection