listing14-8.py
来自「《Beginning Python--From Novice to Profes」· Python 代码 · 共 19 行
PY
19 行
from twisted.internet import reactorfrom twisted.internet.protocol import Protocol, Factoryclass SimpleLogger(Protocol): def connectionMade(self): print 'Got connection from', self.transport.client def connectionLost(self, reason): print self.transport.client, 'disconnected' def dataReceived(self, data): print datafactory = Factory()factory.protocol = SimpleLoggerreactor.listenTCP(1234, factory)reactor.run()
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?