Wait for tcp socket to open