0cae557ab5
looking it up
19 lines
432 B
Python
19 lines
432 B
Python
from sugar.p2p.Notifier import Notifier
|
|
import network
|
|
|
|
class NotificationListener:
|
|
def __init__(self, service):
|
|
server = network.GroupServer(service.get_address(),
|
|
service.get_port(),
|
|
self._recv_multicast)
|
|
server.start()
|
|
|
|
self._listeners = []
|
|
|
|
def add_listener(self, listener):
|
|
self._listeners.append(listener)
|
|
|
|
def _recv_multicast(self, msg):
|
|
for listener in self._listeners:
|
|
listener(msg)
|