Use new Network.are_host_same() equivalency check

Replace the existing "is localhost" checks with the new, more reliable method.
Similarly here, no need to try/except for the socket.gaierror anymore.