Skip to content

Conversation

@sfo2001
Copy link
Owner

@sfo2001 sfo2001 commented Jun 23, 2025

Problem

Discovery fails silently on Windows systems due to ProactorEventLoop not properly handling the "<broadcast>" address, resulting in UDP packets not reaching the network interface. This particularly affects Windows systems with complex network configurations (multiple adapters, VirtualBox, WSL, etc.).

Fixes michaelarnauts#61

Root Cause

The hardcoded "<broadcast>" string in discovery.py:39 works on Linux SelectorEventLoop but fails on Windows ProactorEventLoop, causing silent discovery failures where no bridges are found despite being present on the network.

Solution

  • Replace hardcoded "<broadcast>" with programmatic broadcast address detection using netifaces
  • Add robust fallback to 255.255.255.255 when interface detection fails
  • Improve error handling around protobuf parsing
  • Add comprehensive documentation and logging

Testing

Before (Windows)

Discovered bridges:

After (Windows)

Discovered bridges:
<Bridge 192.168.xxx.yy, UID=000000000022xxxxxxxxxxxxxxxxxxxx>

Cross-platform compatibility

  • Windows: Now works with ProactorEventLoop
  • Linux: Continues to work (tested on both platforms)
  • Fallback: Graceful degradation when network detection fails

Changes

  • Add netifaces dependency for network interface detection
  • Enhance broadcast address resolution logic
  • Improve error handling and logging
  • Modernize type hints to Python 3.10+ standards
  • Add comprehensive function documentation

Breaking Changes

None - maintains full backward compatibility.

The discovery process failed due to the default Python broadcast address not working in all cases, causing UDP packets to not leave the interface and resulting in no units being found in the local network. This fix ensures the correct broadcast address is used.
@sfo2001 sfo2001 merged commit 7bcd5af into master Jun 23, 2025
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discovery fails on Windows - <broadcast> address not working with ProactorEventLoop

2 participants