def datagramReceived(self, data, xxx_todo_changeme):
    (host, port) = xxx_todo_changeme
    print('received %r from %s:%d' % (data, host, port))

def sendHeartBeat(self):
    self.transport.write(self.name, (self.host, self.port))


class HeartbeatReciever(DatagramProtocol):

    def __init__(self, name):
        self.name = name

def startProtocol(self):
    pass
Клиент и сервер UDP с Twisted Python