twgs.tac 580 B

1234567891011121314151617181920
  1. from twisted.application.service import Application
  2. from twisted.application.internet import TCPServer
  3. from twisted.internet import protocol
  4. # twistd -n -y twgs.tac
  5. # https://steemit.com/utopian-io/@mattockfs/tutorial-asynchonous-python-with-twisted-and-asyncio-part-two
  6. import os
  7. import sys
  8. sys.path.append(os.path.abspath('.'))
  9. from config import config, version
  10. from proxy import Player
  11. application = Application('TWGS-Proxy')
  12. factory = protocol.Factory()
  13. factory.protocol = Player
  14. service = TCPServer(config['listen_port'], factory)
  15. service.setServiceParent(application)