Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Echo Server in Twisted Matrix:

  from twisted.internet import protocol, reactor

  class Echo(protocol.Protocol):    
      def dataReceived(self, data):
          self.transport.write(data)

  if __name__ == '__main__':
      factory = protocol.ServerFactory()
      factory.protocol = Echo
      reactor.listenTCP(8000,factory)
      reactor.run()


Exactly, thanks for posting this (you beat me to it).

It's not that we need to constantly respond to every Tornado post with a Twisted rebuttal - but it is appropriate to respond to articles the contain FUD and demonstrate far less elegant, far more verbose, non cross-platform solutions.


Yet, it is just nice seeing how tornado can be re-used outside the core web development.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: