#! /usr/bin/python from twisted.internet.app import Application from twisted.internet import reactor from twisted.spread import pb from copy_sender import LilyPond, CopyPond from twisted.python import log import sys #log.startLogging(sys.stdout) class ReceiverPond(pb.RemoteCopy, LilyPond): pass pb.setUnjellyableForClass(CopyPond, ReceiverPond) class Receiver(pb.Root): def remote_takePond(self, pond): print " got pond:", pond pond.countFrogs() return "safe and sound" # positive acknowledgement def remote_shutdown(self): reactor.stop() app = Application("copy_receiver") app.listenTCP(8800, pb.BrokerFactory(Receiver())) app.run(save=0)