Skip to content

Attempting to bind specific interface using interfaces option doesn't work #193

@kdart

Description

@kdart

The documentation implies that Zeroconf(interfaces=[<localIP>]) should restrict listening to one port. But it did not work because the actual socket is bound to all ports.

The following patch fixes it.

1747c1747
< def new_socket(port: int = _MDNS_PORT) -> socket.socket:
---
> def new_socket(port: int = _MDNS_PORT, address: str = "") -> socket.socket:
1778c1778
<     s.bind(('', port))
---
>     s.bind((address, port))
1840c1840
<                 respond_socket = new_socket()
---
>                 respond_socket = new_socket(address=i)
1843c1843
<                 respond_socket = new_socket(port=0)
---
>                 respond_socket = new_socket(port=0, address=i)

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