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