コード例 #1
0
def main():
    log.msg("******STARTING******")
    app = twisted.internet.app.Application("pygame_server")
    auth = DefaultAuthorizer(app)
    service = PygameService("pygameservice", app, auth)
    players = [["alice", "sekrit"], ["bob", "b0b"], ["charlie", "chuck"], ["david", "password"]]
    setup_players(auth, players)

    # start the application
    app.listenTCP(8800, pb.BrokerFactory(pb.AuthRoot(auth)))
    app.run()
コード例 #2
0
ファイル: GameServer.py プロジェクト: zenki2001cn/SnippetCode
def main():
    log.msg('******STARTING******')
    app = twisted.internet.app.Application("Twist-Tac-Toe")
    auth = DefaultAuthorizer(app)
    service = TwistTacToeService("TwistTacToeService", app, auth)
    players = [["alice", "guest"],
               ["bob", "guest"],
               ["charlie", "guest"],
               ["david", "guest"],
               ["guest0", "guest"],
               ["guest1", "guest"],
               ["guest2", "guest"],
               ["guest3", "guest"],
               ["missive", "guest"],
               ]
    setup_players(auth, players)

    # start the application
    app.listenTCP(8800, pb.BrokerFactory(pb.AuthRoot(auth)))
    app.run()
コード例 #3
0
#! /usr/bin/python

from twisted.spread import pb
import twisted.internet.app
        
class ServerObject(pb.Root):
    def remote_add(self, one, two):
        answer = one + two
        print "returning result:", answer
        return answer
    def remote_subtract(self, one, two):
        return one - two
    
app = twisted.internet.app.Application("server1")
app.listenTCP(8800, pb.BrokerFactory(ServerObject()))
app.run(save=0)