[Twisted-Python] anyway to get data from a protocol instance?

wang wei wgwigw at gmail.com
Wed Aug 9 04:43:19 EDT 2006


please have a look of fellow code.

from twisted.internet import reactor, protocol

class echo(protocol.Protocol):
    def __init__(self):
        from Queue import Queue
        self.q = Queue()

    def lineReceived(self, line):
        self.q.put(line)

class echofactory(protocol.ServerFactory):

    def buildProtocol(self, addr):
        p = echo()
        p.factory = self
        return p

class runEcho:
    def __init__(self):
        a = echofactory()
        reactor.listenTCP(1024, a)
        reactor.run()


My question is how can I get size of Queue q from another class when the
program running.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20060809/e6eb92c1/attachment.htm 


More information about the Twisted-Python mailing list