= Twisted = Twisted is an event-driven networking engine written in Python and licensed under the open source MIT license. == Install from source == * su * cd /tmp * wget [[http://twistedmatrix.com/Releases/Twisted/13.1/Twisted-13.1.0.tar.bz2]] * tar xvif Twisted-13.1.0.tar.bz2 * cd Twisted-13.1.0 * python2.7 setup.py build * python2.7 setup.py install == Test installation == * python * from twisted.internet import protocol, reactor * quit() == Slackbuild == * su * cd /tmp * wget http://slackbuilds.org/slackbuilds/14.1/python/python-twisted.tar.gz * tar xvzf python-twisted.tar.gz * cd python-twisted * wget https://pypi.python.org/packages/source/T/Twisted/Twisted-13.2.0.tar.bz2 * ./python-twisted.SlackBuild * installpkg /tmp/python-twisted-13.2.0-x86_64-1_SBo.tgz Slackware64 14: [[attachment:python-twisted-13.2.0-x86_64-1_SBo.tgz]] == Echo server == {{{#!highlight python from twisted.internet import protocol, reactor class Echo(protocol.Protocol): def dataReceived(self, data): self.transport.write(data) class EchoFactory(protocol.Factory): def buildProtocol(self, addr): return Echo() reactor.listenTCP(1234, EchoFactory()) reactor.run() }}}