a guest Jun 1st, 2013 103 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- class PoetryProtocol(Protocol):
- poem = ''
- def __init__(self):
- self.timeout = None
- self.if_timedout = False
- def timedout(self):
- self.if_timedout = True
- print 'Timed out!'
- def success(self):
- if self.timeout is None or self.if_timedout is True:
- def dataReceived(self, data):
- self.poem += data
- def connectionMade(self):
- self.timeout = reactor.callLater(5, self.timedout)
- def connectionLost(self, reason):
- def poemReceived(self, poem):
RAW Paste Data