wait for a socket to open