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
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()