[Twisted-Python] How to let twisted fall into a deadloop with 100% CPU usage

Yun Mao maoy at cis.upenn.edu
Thu Nov 20 15:21:18 MST 2003


Check this out..

Yun
---------
from twisted.internet.protocol import Protocol, ClientFactory
from sys import stdout

class Echo(Protocol):

    def dataReceived(self, data):
        self.transport.loseConnection()

    def connectionLost(self):
        self.transport.startReading()

class EchoClientFactory(ClientFactory):

    def buildProtocol(self, addr):
        print 'Connected.'
        return Echo()

from twisted.internet import reactor
reactor.connectTCP('158.130.68.33', 22, EchoClientFactory())
reactor.run()







More information about the Twisted-Python mailing list