Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avahi.InvalidServiceTypeError: Invalid service type #83

Open
edward-jw-yu opened this issue Jan 23, 2024 · 1 comment
Open

Avahi.InvalidServiceTypeError: Invalid service type #83

edward-jw-yu opened this issue Jan 23, 2024 · 1 comment

Comments

@edward-jw-yu
Copy link

Ubuntu2004, mdns 1.4.3
gcc -o mdns mdns.c
./mdns --service test_mdnsmw_service1._http._tcp.local. --port 10001 --hostname vbox2.local
./mdns --service test_mdnsmw_service1._dns-sd._tcp.local. --port 10001 --hostname vbox2.local
./mdns --service test._http._tcp.local.
opening avahi-discover came out the following:
Browsing domain 'local' on -1.-1 ...
Browsing for services of type '' in domain 'test._http._tcp.local' on 2.1 ...
ERROR:dbus.connection:Exception in handler for D-Bus signal:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 232, in maybe_handle_message
self._handler(*args, **kwargs)
File "/usr/bin/avahi-discover", line 182, in new_service_type
b = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, self.server.ServiceBrowserNew(interface, protocol, stype, domain, dbus.UInt32(0))), avahi.DBUS_INTERFACE_SERVICE_BROWSER)
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 147, in call
**keywords)
File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 653, in call_blocking
message, timeout)
DBusException: org.freedesktop.Avahi.InvalidServiceTypeError: Invalid service type
Browsing for services of type '' in domain 'test._http._tcp.local' on 2.0 ...
ERROR:dbus.connection:Exception in handler for D-Bus signal:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 232, in maybe_handle_message
self._handler(*args, **kwargs)
File "/usr/bin/avahi-discover", line 182, in new_service_type
b = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, self.server.ServiceBrowserNew(interface, protocol, stype, domain, dbus.UInt32(0))), avahi.DBUS_INTERFACE_SERVICE_BROWSER)
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 147, in call
**keywords)
File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 653, in call_blocking
message, timeout)
DBusException: org.freedesktop.Avahi.InvalidServiceTypeError: Invalid service type

@mjansson
Copy link
Owner

You should not handle DNS-SD like that - the library takes care of service discovery for you (which is handled by a _services._dns-sd._udp.local. query, see RFC in https://datatracker.ietf.org/doc/html/rfc6763)

Your service should probably not be test_mdnsmw_service1._http._tcp.local. - the _http._tcp.local. is the service name normally used for HTTP.

Also, hostname should be without the local suffix.

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

No branches or pull requests

2 participants