Commit f9aa2e26 authored by Yury Selivanov's avatar Yury Selivanov

Add Twisted

parent bc0f5d44
......@@ -49,6 +49,12 @@ benchmarks = [{
'server': python + ['/usr/src/servers/torecho.py'],
'server_address': tcp_address,
'client': tcp_client,
}, {
'name': 'tcpecho-twisted',
'title': 'TCP echo server (twisted)',
'server': python + ['/usr/src/servers/twistedecho.py'],
'server_address': tcp_address,
'client': tcp_client,
}, {
'name': 'tcpecho-curio-socket',
'title': 'TCP echo server (curio/socket)',
......
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet import reactor, protocol
class Echo(protocol.Protocol):
"""This is just about the simplest possible protocol"""
def dataReceived(self, data):
"As soon as any data is received, write it back."
self.transport.write(data)
def main():
"""This runs the protocol on port 25000"""
factory = protocol.ServerFactory()
factory.protocol = Echo
reactor.listenTCP(25000,factory)
reactor.run()
# this only runs if the module was *not* imported
if __name__ == '__main__':
main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment