Revisión 90
Añadido por Manu Mora Gordillo hace alrededor de 14 años
avahiClient.py | ||
---|---|---|
import dbus, gobject, avahi
|
||
from dbus import DBusException
|
||
from dbus.mainloop.glib import DBusGMainLoop
|
||
import threading
|
||
|
||
class avahiClient(object):
|
||
class avahiClient(threading.Thread):
|
||
|
||
names = []
|
||
|
||
def __init__ (self):
|
||
def __init__(self):
|
||
threading.Thread.__init__(self)
|
||
|
||
def run(self):
|
||
|
||
loop = DBusGMainLoop()
|
||
bus = dbus.SystemBus(mainloop=loop)
|
||
|
||
... | ... | |
|
||
self.loop = gobject.MainLoop()
|
||
self.loop.run()
|
||
|
||
|
||
|
||
def service_resolved(self,*args):
|
||
#print args
|
||
print 'service resolved'
|
||
print 'name:', args[2]
|
||
print 'address:', args[7]
|
||
print 'port:', args[8]
|
||
#print args
|
||
#print args
|
||
self.names.append(args[2])
|
||
|
||
#self.loop.quit()
|
Exportar a: Unified diff
Intentando avahi con threads