Ticket #5562: bugs_5562_server.py

File bugs_5562_server.py, 0.5 KB (added by dynamicgl, 18 months ago)
Line 
1#coding=utf-8
2from twisted.internet import iocpreactor,protocol
3iocpreactor.install()
4from twisted.internet import reactor,defer,task
5
6class EchoProtocol(protocol.Protocol):
7    def dataReceived(self,data):
8        self.transport.write(data)
9
10class EchoFactory(protocol.Factory):
11    dataLen = 0
12    dataBuffer = ''
13    def buildProtocol(self,addr):
14        p = EchoProtocol()
15        p.factory = self
16        return p
17
18
19if __name__ == "__main__":
20    reactor.listenTCP(12345, EchoFactory())
21    reactor.run()