svinota / mdns Goto Github PK
View Code? Open in Web Editor NEWmDNS library
License: GNU General Public License v3.0
mDNS library
License: GNU General Public License v3.0
I get this error when get Pidgin change the status (python 3.4.0 on sailfish OS)
File "./embedded_libs/mdns/zeroconf.py", line 1138, in run
self.readers[socket].handle_read()
File "./embedded_libs/mdns/zeroconf.py", line 1185, in handle_read
msg = DNSIncoming(data)
File "./embedded_libs/mdns/zeroconf.py", line 691, in __init__
self.read_others()
File "./embedded_libs/mdns/zeroconf.py", line 774, in read_others
self.read_name())
File "./embedded_libs/mdns/zeroconf.py", line 842, in read_name
result = ''.join((result, self.read_utf(off, len) + '.'))
File "./embedded_libs/mdns/zeroconf.py", line 825, in read_utf
result = self.data[offset:offset + len].decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte
I've started to write service from scratch based on most recent version of the RFC 6763.
You could follow the work here: https://github.com/GreatFruitOmsk/mdns/tree/new_service
The main goal is to pre-validate and provide as much feedback as possible to the developer to simplify writing a robust code. The idea is also to provide a sufficient documentation so developer could understand most of the RFC from the code.
@svinota Please tell me what you think about this.
As I understand, this library is pure python implementation of dns-sd and mdns.
Is it indented to be compatible with Bonjour or Avahi?
Can it coexist with an installation of Bonjour/Avahi on the same machine?
It appears that mdns is a bit inaccurate in documentation. In example:
class ServiceInfo(object):
"""Service information"""
def __init__(self, type, name, address=None, port=None, weight=0,
priority=0, properties=None, server=None, records=None,
ttl=_DNS_TTL, signer=None):
"""Create a service description.
domain: fully qualified service type name
name: fully qualified service name
address: IP address as unsigned short, network byte order
port: port that the service runs on
weight: weight of the service
priority: priority of the service
properties: dictionary of properties (or a string holding the bytes
for the text field)
server: fully qualified name for service host (defaults to name)"""
domain
anymore. It was replaced by type
. 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"But how one supposed to advertise a service? I'm trying:
z = Zeroconf()
ServiceInfo('_tcp.', 'blablabla._tcp.', address=socket.inet_aton('192.168.1.10'), port=socket.htons(25000))
z.register_service(i)
But I don't see service in the Bonjour Browser app.
Could you be so kind and point me where I'm wrong?
When I try to register a service in a thread, I get this :
Exception in thread Thread-7:
Traceback (most recent call last):
File "/usr/lib/python3.4/threading.py", line 921, in _bootstrap_inner
self.run()
File "/home/nemo/dev/HeySms/heysms/lib/friend.py", line 103, in run
info = ServiceInfo(d, n, inet_aton('192.168.2.38'), 12345, properties=txt)
File "./embedded_libs/mdns/zeroconf.py", line 1362, in __init__
self.set_properties(self.properties)
File "./embedded_libs/mdns/zeroconf.py", line 1388, in set_properties
self.sync_properties()
File "./embedded_libs/mdns/zeroconf.py", line 1382, in sync_properties
self.text = dict_to_text(self.properties)
File "./embedded_libs/mdns/zeroconf.py", line 231, in dict_to_text
list.append('='.join((key, suffix)))
TypeError: sequence item 1: expected str instance, bytes found
You can see the code here : https://github.com/titilambert/HeySms/blob/master/heysms/lib/friend.py
Hello !
I'm trying to run mdns on python3 (3.4)
I get this error:
Traceback (most recent call last):
File "/home/nemo/dev/HeySms/snipets/bad/mdns/zeroconf.py", line 1131, in run
self.readers[socket].handle_read()
File "/home/nemo/dev/HeySms/snipets/bad/mdns/zeroconf.py", line 1178, in handle_read
msg = DNSIncoming(data)
File "/home/nemo/dev/HeySms/snipets/bad/mdns/zeroconf.py", line 684, in __init__
self.read_others()
File "/home/nemo/dev/HeySms/snipets/bad/mdns/zeroconf.py", line 754, in read_others
domain = self.read_name()
File "/home/nemo/dev/HeySms/snipets/bad/mdns/zeroconf.py", line 829, in read_name
len = ord(self.data[off])
TypeError: ord() expected string of length 1, but int found
Hello !
I'm trying to use your beautiful lib !
I succeed to register my service using issue #3 .
Now I'm trying to use the Service Browser.
Could you give me an example of it ?
After I finish my tests, I could submit a pull request with some basic examples if you want.
https://github.com/svinota/mdns/blob/master/mdns/zeroconf.py#L932-L956
I cannot find RFC that requires that parsing and defines packing algorithm used by this implementation.
@svinota Do you know it?
The code of this lib seems a bit outdated and requires some refactoring and documenting. Which version of python is considered minimum for contribution? Python 2.6 sounds like a reasonable choice for me.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.