Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from twisted.internet import protocol, reactor
- class Echo(protocol.Protocol):
- def dataReceived(self, data):
- print("DONE")
- self.transport.write(data)
- def connectionMade(self):
- self.transport.write("Hello, world!")
- class EchoFactory(protocol.Factory):
- def buildProtocol(self, addr):
- return Echo()
- reactor.listenTCP(8080, EchoFactory())
- reactor.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement