Advertisement
Guest User

Untitled

a guest
Mar 17th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. from twisted.internet import protocol, reactor
  2.  
  3. class Echo(protocol.Protocol):
  4.     def dataReceived(self, data):
  5.         print("DONE")
  6.         self.transport.write(data)
  7.    def connectionMade(self):
  8.        self.transport.write("Hello, world!")
  9.  
  10.  
  11. class EchoFactory(protocol.Factory):
  12.     def buildProtocol(self, addr):
  13.         return Echo()
  14.  
  15. reactor.listenTCP(8080, EchoFactory())
  16. reactor.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement