You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
476 B
Python

from sugar.p2p import network
18 years ago
from sugar.p2p.Service import Service
18 years ago
class Notifier:
TYPE = "_olpc_model_notification._udp"
ADDRESS = "224.0.0.222"
PORT = 6300
18 years ago
def __init__(self, group, name):
service = Service(name, Notifier.TYPE, Notifier.PORT, Notifier.ADDRESS)
service.register(group)
address = service.get_group_address()
18 years ago
port = service.get_port()
self._client = network.GroupClient(address, port)
def notify(self, msg):
self._client.send_msg(msg)