Wait for socket to connect