diff --git a/zeroconf.py b/zeroconf.py index 976897a7..a5fe3150 100644 --- a/zeroconf.py +++ b/zeroconf.py @@ -1264,9 +1264,12 @@ def __init__( self._respond_sockets = [] for i in interfaces: - self._listen_socket.setsockopt( - socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, - socket.inet_aton(_MDNS_ADDR) + socket.inet_aton(i)) + try: + self._listen_socket.setsockopt( + socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, + socket.inet_aton(_MDNS_ADDR) + socket.inet_aton(i)) + except Exception: + pass respond_socket = new_socket() respond_socket.setsockopt( @@ -1587,7 +1590,7 @@ def close(self): logging.basicConfig(level=logging.DEBUG) log.setLevel(logging.DEBUG) print("Multicast DNS Service Discovery for Python, version %s" % __version__) - r = Zeroconf() + r = Zeroconf(InterfaceChoice.All) print("1. Testing registration of a service...") desc = {'version': '0.10', 'a': 'test value', 'b': 'another value'} info = ServiceInfo("_http._tcp.local.",