frawau / aiozeroconf

An asyncio/pure python implementation of multicast DNS service discovery
GNU Lesser General Public License v2.1
24 stars 6 forks source link

aiozeroconf does not work on Windows #1

Closed jerblack closed 6 years ago

jerblack commented 6 years ago

Hi, thanks for enabling your issue tracker. I am unable to use aiozeroconf on WIndows at the moment. If I execute the code below, I get an AttributeError. The three lines below are all I need to see an error.

import aiozeroconf, asyncio
loop = asyncio.get_event_loop()
zc = aiozeroconf.Zeroconf(loop)

Traceback

Traceback (most recent call last):
  File "test.py", line 3, in <module>
    zc = aiozeroconf.Zeroconf(loop)
  File "C:\Python36-32\lib\site-packages\aiozeroconf\aiozeroconf.py", line 1585, in __init__
    sock = new_socket(af,iface)
  File "C:\Python36-32\lib\site-packages\aiozeroconf\aiozeroconf.py", line 1540, in new_socket
    s.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_MULTICAST_HOPS, ttl)
AttributeError: module 'socket' has no attribute 'IPPROTO_IPV6'

I notice you are using IPv6 by default, but the implementation of new_socket in zeroconf only appears to use IPv4. Do you have documentation on other defaults or method signatures you changed from zeroconf to your fork?

frawau commented 6 years ago

Actually, by default it uses both IPv4 and IPv6.

Try zc = aiozeroconf.Zeroconf(loop, address_family = [netifaces.AF_INET])

To limit to IPv4

The original package only uses IPv4

frawau commented 6 years ago

Also

zc = aiozeroconf.Zeroconf(loop, address_family = [socket.AF_INET])

frawau commented 6 years ago

Can I close this issue?