Moved code for getting IP address to listen on into the retry loop so that if there is no network right away on restart, the address can be determined later.