Я только изучаю Python и Twisted и не могу понять, почему этот простой сервер не работает. Self.transport.write не работает при вызове из таймера. Я не получаю ошибки вообще. Любая помощь приветствуется. Большое спасибо!
from twisted.internet.protocol import Factory, Protocol
from twisted.internet import reactor
from threading import Timer
class proto(Protocol):
def saySomething(self):
self.transport.write('hello there\r\n')
def connectionMade(self):
Timer(5, self.saySomething).start()
class theFactory(Factory):
protocol = proto
reactor.listenTCP(8007, theFactory())
reactor.run()