server: retry until the socket opens successfully