blob: 54ce73591c035f5e857a827c3d632ba1b7e23bce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
from sugar.p2p import network
from sugar.presence.Service import Service
class Notifier:
TYPE = "_olpc_model_notification._udp"
ADDRESS = "224.0.0.222"
PORT = 6300
def __init__(self, group, name):
service = Service(name, Notifier.TYPE, Notifier.PORT, Notifier.ADDRESS)
service.register(group)
address = service.get_group_address()
port = service.get_port()
self._client = network.GroupClient(address, port)
def notify(self, msg):
self._client.send_msg(msg)
|