GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — No service found under Windows but working under Ubuntu VM. · Issue #84 · python-zeroconf/python-zeroconf

No service found under Windows but working under Ubuntu VM. #84

New issue
Copy link
New issue
Copy link
Closed
Closed
No service found under Windows but working under Ubuntu VM.#84
Copy link

Description

@basic-settings
basic-settings
opened on Sep 28, 2016
Issue body actions

I am facing some issues in setting up a client/ServiceBrowser that works under both Win and Linux.

I have the following set-up:

  • Win 7 connected to domain
    • Ethernet config uses IPv4 with Subnet Mask 255.255.255.0
  • Ubuntu VM running on the same system in Oracle VirtualBox with Win Ethernet as Bridged Adapter
    enp0s3 Link encap:Ethernet HWaddr 08:00:27:55:62:63 inet addr:10.121.44.95 Bcast:10.121.44.255 Mask:255.255.255.0 inet6 addr: fe80::aa6b:92c:17c4:cfc8/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1837029 errors:0 dropped:0 overruns:0 frame:0 TX packets:110395 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:467243091 (467.2 MB) TX bytes:7871423 (7.8 MB)
  • The broadcasting systems are running on different Debian systems connected to the network domain

If I run the ServiceBrowser from Windows I don't get any return back. I used the example Browser to test the set-up.
`from zeroconf import ServiceBrowser, Zeroconf

class MyListener(object):

def remove_service(self, zeroconf, type, name):
    print("Service %s removed" % (name,))

def add_service(self, zeroconf, type, name):
    info = zeroconf.get_service_info(type, name)
    print("Service %s added, service info: %s" % (name, info))

zeroconf = Zeroconf()
listener = MyListener()
browser = ServiceBrowser(zeroconf, "_tntsrv._tcp.local.", listener)
try:
input("Press enter to exit...\n\n")
finally:
zeroconf.close()`
Running from withing Ubuntu, it returns all the available services (as expected).

I noticed that if I change HOST_ONLY_NETWORK_MASK from 255.255.255.255 to 255.255.255.0 the opposite happens, where it works under Windows but not under Ubuntu.

This seems to ocurr in line 1603
if addr.get('netmask') != HOST_ONLY_NETWORK_MASK

I'm not experienced enough to find a common ground, but is there any posibility so that it'll work under both systems?

Activity

  1. basic-settings commented on Sep 28, 2016

    @basic-settings
    basic-settings
    on Sep 28, 2016
    Author
    More actions

    For the time being, removing:
    if addr.get('netmask') != HOST_ONLY_NETWORK_MASK

    from:
    return list(set( addr['addr'] for iface in netifaces.interfaces() for addr in netifaces.ifaddresses(iface).get(address_family, []) if addr.get('netmask') != HOST_ONLY_NETWORK_MASK ))
    does the trick.

  2. sniperlucian commented on Oct 3, 2016

    @sniperlucian
    sniperlucian
    on Oct 3, 2016
    More actions

    same here. chromecast is found on ubuntu but not on windows.

    commenting out the line

    if addr.get('netmask') != HOST_ONLY_NETWORK_MASK

    makes it work under win7 too.

  3. jackha commented on Oct 6, 2016

    @jackha
    jackha
    on Oct 6, 2016
    More actions

    I got a similar problem with the ServiceBrowser not finding any devices. The cause was one of zeroconf's dependencies: netifaces. Installing the latest version will download version 0.10.5, but with this version it breaks my ServiceBrowser by not finding anything. Downgrading to 0.10.4 and everything works fine.

    pip uninstall netifaces
    pip install netifaces==0.10.4

    ps. tested with zeroconf version 0.17.6 as well as 0.17.5
    ps. I got a windows 32 bit environment, but I think the problem may be platform independent.

    Reacted by Dave Man
  4. gbiddison commented on Oct 14, 2016

    @gbiddison
    gbiddison
    on Oct 14, 2016
    More actions

    I can confirm this problem on python 32 under windows 7.
    I have not been able to get netifaces 0.10.4 to successfully build under win7, but the change suggested by @sniperlucian does appear to get it to work.

  5. gbiddison commented on Oct 14, 2016

    @gbiddison
    gbiddison
    on Oct 14, 2016
    More actions

    The problem does not occur with 64 bit python under win7, I don't have an explanation for this though.

  6. bannsec commented on Oct 21, 2016

    @bannsec
    bannsec
    on Oct 21, 2016
    More actions

    The problem is occurring for me on Win10 Python 64-bit. I'm using zeroconf 0.10.5. Same as previous posters, the fix that basic-settings suggested works for me. In my Windows setting, I am not able to easily downgrade to zeroconf 0.10.4 due to not having the C++ build tools (and not wanting to install 4 gigs worth of them).

    A full solution would be nice. Also, Windows wheel files for 0.10.4 would be nice as well.

  7. gbiddison
    added 2 commits that reference this issue on Dec 6, 2016

    upstream issue python-zeroconf#84 fix for windows compatibility

    e589895

    Merge pull request #8 from gbiddison/dev/fix_for_upstream_84

    2d1c63c
  8. jimmyharris commented on Mar 21, 2017

    @jimmyharris
    jimmyharris
    on Mar 21, 2017
    More actions

    I am seconding @gbiddison on this. We either need to remove this check or change setup.py line 59 to read in order to

            'netifaces<=0.10.4',

    Or drop the following check from zeroconf.py line 1590

            if addr.get('netmask') != HOST_ONLY_NETWORK_MASK

    Alternately we could modify the above check to only take effect on non windows platforms.

    import platform
    
    # intervening code to line 1590
            if (platform.system() == 'Windows') or (addr.get('netmask') != HOST_ONLY_NETWORK_MASK)

    Either of these will fix the issue with windows compatibility.

    My company would really like to use this as part of our build system, but we cannot do it if windows is not supported.

  9. jstasiak commented on Mar 21, 2017

    @jstasiak
    jstasiak
    on Mar 21, 2017
    Collaborator
    More actions

    This seems relevant: https://bitbucket.org/al45tair/netifaces/issues/39/netmask-is-always-255255255255

  10. jstasiak commented on Mar 21, 2017

    @jstasiak
    jstasiak
    on Mar 21, 2017
    Collaborator
    More actions

    Version 0.19.0 has just been released with the netifaces<=0.10.4 restriction in place, please reopen the issue if it didn't help.

  11. jstasiak
    closed this as completedon Mar 21, 2017
  12. jimmyharris commented on Mar 21, 2017

    @jimmyharris
    jimmyharris
    on Mar 21, 2017
    More actions

    Thanks @jstasiak!

    How long does that usually take to propagate up to PyPI?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.