# HG changeset patch # User Edouard Tisserant # Date 1540294455 -7200 # Node ID dd959601e67a089391fc29f7b2cb9541346c531d # Parent 0a951f528c69aa68ae8636ee71811b7f9c876766 Force Zeroconf to listen and answer only on interface specified with '-i' command line argument. diff -r 0a951f528c69 -r dd959601e67a runtime/ServicePublisher.py --- a/runtime/ServicePublisher.py Tue Oct 23 13:31:26 2018 +0200 +++ b/runtime/ServicePublisher.py Tue Oct 23 13:34:15 2018 +0200 @@ -56,11 +56,15 @@ self.name = name self.port = port - self.server = zeroconf.Zeroconf() - print("MDNS brodcasting on :" + ip) + if ip == "0.0.0.0": + print("MDNS brodcasted on all interfaces") + interfaces=zeroconf.InterfaceChoice.All + ip = self.gethostaddr() + else: + interfaces=[ip] - if ip == "0.0.0.0": - ip = self.gethostaddr() + self.server = zeroconf.Zeroconf(interfaces=interfaces) + print("MDNS brodcasted service address :" + ip) self.ip_32b = socket.inet_aton(ip)