473,395 Members | 2,437 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

problems with pyzeroconf and linux


Hi all,
I am trying to get pyzeroconf (http://sourceforge.net/projects/pyzeroconf)
running on my machine but having trouble... Running the Zeroconf.py file
seems to register the service, but is unable to find it.

(same situation than in
http://www.nabble.com/pyzeroconf-on-....-t481215.html, but differenet
cause, I'm sure..)

"""
Multicast DNS Service Discovery for Python, version 0.12
1. Testing registration of a service...
Registering service...
Registration done.
2. Testing query of service information...
Getting ZOE service: None
Query done.
3. Testing query of own service...
Getting self: None
Query done.
4. Testing unregister of service information...
Unregister done.
"""

Running ethereal reveals that there are no responses to the 2) and
3)...The queries are certainly there. I'm runnin this with Ubuntu Dapper in
a WLAN network. I am not too familiar with networking in Linux environment,
so if anyone has any help on how to get it running, I would appreciate. :)
Best Regards,
Simo Hosio
Jan 26 '07 #1
2 1832
I am trying to get pyzeroconf (http://sourceforge.net/projects/pyzeroconf)
running on my machine but having trouble... Running the Zeroconf.py file
seems to register the service, but is unable to find it.
You should be running avahi.. it also comes python support.

Here's an example that registers a CNAME that points to your hostname (that
avahi itself publishes)

#! /usr/bin/env python
import avahi, dbus
from encodings.idna import ToASCII

# Got these from /usr/include/avahi-common/defs.h
CLASS_IN = 0x01
TYPE_CNAME = 0x05

TTL = 60

def publish_cname(cname):
bus = dbus.SystemBus()
server = dbus.Interface(bus.get_object(avahi.DBUS_NAME,
avahi.DBUS_PATH_SERVER),
avahi.DBUS_INTERFACE_SERVER)
group = dbus.Interface(bus.get_object(avahi.DBUS_NAME,
server.EntryGroupNew()),
avahi.DBUS_INTERFACE_ENTRY_GROUP)

rdata = createRR(server.GetHostNameFqdn())
cname = encode_dns(cname)

group.AddRecord(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, dbus.UInt32(0),
cname, CLASS_IN, TYPE_CNAME, TTL, rdata)
group.Commit()
def encode_dns(name):
out = []
for part in name.split('.'):
if len(part) == 0: continue
out.append(ToASCII(part))
return '.'.join(out)

def createRR(name):
out = []
for part in name.split('.'):
if len(part) == 0: continue
out.append(chr(len(part)))
out.append(ToASCII(part))
out.append('\0')
return ''.join(out)

if __name__ == '__main__':
import time, sys, locale
for each in sys.argv[1:]:
name = unicode(each, locale.getpreferredencoding())
publish_cname(name)
try:
while 1: time.sleep(60)
except KeyboardInterrupt:
print "Exiting"
--
damjan
Jan 27 '07 #2

On Sat, 27 Jan 2007, Damjan wrote:
>
>I am trying to get pyzeroconf (http://sourceforge.net/projects/pyzeroconf)
running on my machine but having trouble... Running the Zeroconf.py file
seems to register the service, but is unable to find it.

You should be running avahi.. it also comes python support.

Here's an example that registers a CNAME that points to your hostname (that
avahi itself publishes)

#! /usr/bin/env python
import avahi, dbus
from encodings.idna import ToASCII

# Got these from /usr/include/avahi-common/defs.h
CLASS_IN = 0x01
TYPE_CNAME = 0x05

TTL = 60

def publish_cname(cname):
bus = dbus.SystemBus()
server = dbus.Interface(bus.get_object(avahi.DBUS_NAME,
avahi.DBUS_PATH_SERVER),
avahi.DBUS_INTERFACE_SERVER)
group = dbus.Interface(bus.get_object(avahi.DBUS_NAME,
server.EntryGroupNew()),
avahi.DBUS_INTERFACE_ENTRY_GROUP)

rdata = createRR(server.GetHostNameFqdn())
cname = encode_dns(cname)

group.AddRecord(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, dbus.UInt32(0),
cname, CLASS_IN, TYPE_CNAME, TTL, rdata)
group.Commit()
def encode_dns(name):
out = []
for part in name.split('.'):
if len(part) == 0: continue
out.append(ToASCII(part))
return '.'.join(out)

def createRR(name):
out = []
for part in name.split('.'):
if len(part) == 0: continue
out.append(chr(len(part)))
out.append(ToASCII(part))
out.append('\0')
return ''.join(out)

if __name__ == '__main__':
import time, sys, locale
for each in sys.argv[1:]:
name = unicode(each, locale.getpreferredencoding())
publish_cname(name)
try:
while 1: time.sleep(60)
except KeyboardInterrupt:
print "Exiting"
--
damjan
Hi,
I actually tried Avahi also at first, but was having a lot of difficulties
setting it up to my actual target environment (Maemo platform, based on
Debian, and used on Nokia 770&N800 devices...).

Probably this is anyhow an issue of Debian network configuration, so maybe
I'll ask the lists there also.

I will later utilize Avahi, if possible, so thanks for the code snippet. :)
And if anyone knows what might be the propblem with Pyzeroconf and my dear
Ubuntu, please tell me.

Br,
Simo
Jan 29 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: PyUser | last post by:
Hello, Just downloaded the 2.3.2 bzip2 package and trying to install. When I run 'make', I get the following error: ..... ..... running build running build_ext make: *** Error 139 $ uname...
1
by: djw | last post by:
AMK, thanks for your work on PyZeroConf! Using PyZeroConf 0.12. I'm seeing an issue with the Browser.py code. I am scanning for printers using: type = "_pdl-datastream._tcp.local." The...
10
by: stu7 | last post by:
+ I have some problems with QT. I know that it is supposed to be useful for compiling cross-platform versions of a program, and that it has something to do with C++ ...not a problem so far. ...
3
by: zeedan | last post by:
Hi, I appologise if I'm not posting this to the correct group, but I'm having problems starting MySQL server. I need it in order to post a websurvey for a research project I'm doing for a college...
2
by: matt | last post by:
Hey, has anyone out there tried pyzeroconf on Linux? I'm using Andrew's code from http://www.amk.ca/python/zeroconf to publish and discover services. The code works under Mac. But it doesn't...
0
by: matt | last post by:
Since I'm on the topic of pyzeroconf today, I might as well keep posting ;) So on to another platform... windows. Has anyone used pyzeroconf on Windows recently? It doesn't appear to work (and...
33
by: wespvp | last post by:
When I try to run thread_test.c from the CVS tip, it hangs in an infinite CPU loop on both linux (RedHat AS 3.0, gcc 3.2.3) and Mac OS X 10.3.3 (gcc 3.3). I've also tried down to gcc 2.96 on Mac...
0
by: Ralph Butler | last post by:
Hi: I have been using pyzeroconf to register and discover services on a local network using the default multicast support. Now, I would like to register a service on a remote node and discover...
4
by: Chuck Chopp | last post by:
I have an application that I originally built using Visual Studio .NET 2003 as native C++ . This application includes a template class that was derived from the string class that's part of the C++...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.