Fall back to a loopback address if the current machine does not have an external IP address (as will be the case when there is no internet connection).

Fixes issue 5958