Open Kentzo opened 10 years ago
Due to security reasons, by default mdns module doesn't listen on any public sockets.
So in order to see anything, you have to explicitly choose addresses to be exposed on:
z = Zeroconf(address=['127.0.0.1', '192.168.0.1'])
Thanks for reporting, I will fix the doc issue asap.
@svinota I'm not trying to find a service. Instead, I'm trying to make service advertised via mdns visible to others. In this "others" is the Bonjour Browser application.
@svinota Could you also clarify what name
means? As per RFC6763, Service Instance Name =
As far as understand, type
is name
have to end with type
?
I'm trying to make service advertised via mdns visible to others.
Exactly. By default Zeroconf instances are not public, you have to explicitly specify interfaces to listen on by giving appropriate IP addrs of interfaces (needed by setsockopt() for IP_MULTICAST_IF and IP_ADD_MEMBERSHIP)
Could you also clarify what
name
means?
FQDN of the service.
As far as understand,
type
is . But what are and ?
Don't think I completely understand the question
And why
name
have to end withtype
?
Just a bad (really bad) design. Actually, this library needs a deep refactoring.
@svinota Sorry, for some reason question missed a few really important keywords :)
As per RFC6763, Service Instance Name = <Instance> . <Service> . <Domain>
. How can I map name
and type
terms to this definition?
name = <Instance> . <Service> . <Domain> .
type = <Domain> .
I hope in some mean time I will remove this ancient requirement. If you can help — welcome. Anyway, thanks that pointing this out, w/o the request it wouldn't move on.
np
@svinota, So, here is the complete program I'm trying to run:
from mdns.zeroconf import *
import socket
z = Zeroconf(address=['127.0.0.1'])
s = ServiceInfo('local.', 'MyName._ssh._tcp.local.', address=socket.inet_aton('192.168.1.100'), port=socket.htons(25000))
z.register_service(s)
z.engine.join()
I'm checking with the dns-sd tool bundled with OSX 10.9:
$dns-sd -B _ssh._tcp. local.
Browsing for _ssh._tcp..local.
DATE: ---Sat 14 Dec 2013---
9:29:41.622 ...STARTING...
Timestamp A/R Flags if Domain Service Type Instance Name
9:29:41.624 Add 2 4 local. _ssh._tcp. Kentzo-Air
As you can see, there is only one such service that's always advertised on my machine, but not the new one.
yep, reproduced. It looks like you found a bug in the service announce code.
Will fix it today, thanks a lot.
Fixed in 95af39201e7640dbdf288103bde00d893893e4bf
Used test code:
from mdns.zeroconf import *
from socket import *
r = Zeroconf(("127.0.0.1", '192.168.0.1'))
n = 'bala._workstation._tcp.local.'
d = '_workstation._tcp.local.'
info = ServiceInfo(d, n, inet_aton('192.168.0.1'), 1234)
r.register_service(info)
raw_input(" >> ")
Checked with avahi-browse.
Pls verify
@svinota I'm using OSX 10.9, so I'm browsing for dns-sd messages like this:
$dns-sd -B _workstation._tcp local.
Unfortunately it still doesn't work when I'm running your script. However, if I register service via the dns-sd tool:
$dns-sd -R my _workstation._tcp local. 1234
It will appear in the browser.
Unfortunately, neither have I OSX, nor have knowledge of this system, so all I can right now — is to check compatibility with Avahi. Next week I will ask guys having OSX to validate the work of the library; until that I can rely only on your help.
Can you please check, that avahi-browse sees the service, registered with the mdns library and the service registered via dns-sd in the same way? Does Avahi sees the library service on your system at all?
It appears that mdns is a bit inaccurate in documentation. In example:
domain
anymore. It was replaced bytype
. As far as I understand possible values are defined in RFC 2782.address
description appears to be inaccurate: it's obviously not unsigned short. As far as I understood from the code, it should be inet_aton (inet_pton?) representation.port
should be "unsigned short, network byte order" Other properties are not clear to me either (some reference to the docs would be helpful)But how one supposed to advertise a service? I'm trying:
But I don't see service in the Bonjour Browser app. Could you be so kind and point me where I'm wrong?