Hello, I'm trying to understand how can I use Perspective Broker to send
some data getted from a TCP listener to another process...

I can't figure out how to get it....


from twisted.internet import protocol, reactor
from twisted.python import log

from twisted.spread import pb


class Service(protocol.Protocol):
    extra = {}
  def dataReceived(self, data):
  extra = doSomething(data)
  #SEND extra TO ANOTHER PROCESS -- FAILED CODE
        factory = pb.PBClientFactory()
        reactor.connectTCP("localhost", 8798, factory)
        root = factory.getRootObject()

        def got_root(root):
          rc = root.callRemote("get", data)
            def got_value(v):
              print v
                reactor.stop()
            rc.addCallback(got_value)

        root.addCallback(got_root)
        reactor.run()
                ....

class ServerFactory(protocol.Factory):
    def buildProtocol(self, addr):
        return Service()

reactor.listenTCP(8797, ServerFactory())
reactor.run()

This testing code fails, I know I'm wrong, please could somebody help me to
understand and get it?
Thanks in advance.
Christian Espinoza.
_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to