2
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
3
# See LICENSE for details.
6
from twisted.internet import reactor, protocol
9
class Echo(protocol.Protocol):
10
"""This is just about the simplest possible protocol"""
12
def dataReceived(self, data):
13
"As soon as any data is received, write it back."
14
self.transport.write(data)
18
"""This runs the protocol on port 8000"""
19
factory = protocol.ServerFactory()
20
factory.protocol = Echo
21
reactor.listenTCP(8000,factory)
24
# this only runs if the module was *not* imported
25
if __name__ == '__main__':