コード例 #1
0
ファイル: ServerBackend.py プロジェクト: suiody/graduate_demo
 def __init__(self):
     self.uiSocketServer = socket(AF_INET, SOCK_STREAM)
     self.uiSocketServer.bind(('0.0.0.0', 12347))
     self.uiSocketServer.listen(5)
     self.ctlChannel = ServerControl()
     self.ctlChannel.Start()
     self.stop = False
     self.typeID = -1
コード例 #2
0
def main():
    server = ServerControl()
    server.Start()

    try:
        while True:
            command = raw_input("command:")
            if command == "end":
                server.Stop()
                break
            elif command == "help":
                print "end: stop the server"
                print "help: show this message"
                pass
            elif command == "setratio":
                ratioStr = raw_input("ratio is:")
                ratio = float(ratioStr)
                server.SetRatio(ratio)
    except KeyboardInterrupt:
        server.Stop()