Skip to content

Socket Errors on Win 10 with 0.29 #337

@shauneccles

Description

@shauneccles

Hi,

0.29 appears to have caused issues with Windows 10 - it appears to have something to do with attempts to bind to private IP addresses when called without specified IP address (ie, DEFAULT).

Using the provided browser example on Win 10, zeroconf 0.29 and py39;

DEBUG:zeroconf:Creating new socket with port 5353, ip_version IPVersion.V4Only, apple_p2p False and bind_addr ('',)
DEBUG:zeroconf:Created socket <socket.socket fd=296, family=AddressFamily.AF_INET, type=SocketKind.SOCK_DGRAM, proto=0, laddr=('0.0.0.0', 5353)>
DEBUG:zeroconf:Adding '169.254.115.209' (socket 296) to multicast group
INFO:zeroconf:Address not available when adding 169.254.115.209 to multicast group, it is expected to happen on some systems
DEBUG:zeroconf:Creating new socket with port 5353, ip_version IPVersion.V4Only, apple_p2p False and bind_addr ('169.254.115.209',)
Traceback (most recent call last):
  File "C:\Users\shaun\ledfx_venv_3.9\LedFx\test.py", line 60, in <module>
    zeroconf = Zeroconf(ip_version=ip_version)
  File "C:\Users\shaun\ledfx_venv_3.9\lib\site-packages\zeroconf\__init__.py", line 2508, in __init__
    self._listen_socket, self._respond_sockets = create_sockets(
  File "C:\Users\shaun\ledfx_venv_3.9\lib\site-packages\zeroconf\__init__.py", line 2343, in create_sockets
    respond_socket = new_respond_socket(i, apple_p2p=apple_p2p)
  File "C:\Users\shaun\ledfx_venv_3.9\lib\site-packages\zeroconf\__init__.py", line 2302, in new_respond_socket
    respond_socket = new_socket(
  File "C:\Users\shaun\ledfx_venv_3.9\lib\site-packages\zeroconf\__init__.py", line 2250, in new_socket
    s.bind((bind_addr[0], port, *bind_addr[1:]))
OSError: [WinError 10049] The requested address is not valid in its context

Explicitly passing an active IP address using
zeroconf = Zeroconf(ip_version=ip_version,interfaces=["192.168.1.166"])
results in the expected output.

Using the same example on Win 10, zeroconf 0.28.8 and py39 I get the expected results.

ipconfig output;



Ethernet adapter vEthernet (WSL):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::95a6:732f:6d4e:c491%54
   IPv4 Address. . . . . . . . . . . : 172.23.0.1
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . :

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::e5bd:9a9a:d8c7:e24c%17
   IPv4 Address. . . . . . . . . . . : 192.168.1.166
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.1.1

Wireless LAN adapter Local Area Connection* 1:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Local Area Connection* 2:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter WiFi:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Ethernet adapter Bluetooth Network Connection:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Cheers,
Shaun

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions