def maincode(): # os.system('C:/Users/Scottar/Desktop/Contest/华为云鲲鹏开发者大赛-试题工程0801/试题工程/server/gameserver.bat') #用于本地的测试 # os.system('C:/Users/Scottar/Desktop/Contest/华为云鲲鹏开发者大赛-试题工程0801/试题工程') # sys.argv = ['gameclient.bat', b'1515', b'127.0.0.1', b'6001'] # sys.argv = ['gameclient.bat', b'1515', b'119.3.169.43', b'6001'] # os.system('E:/Contest/华为云鲲鹏开发者大赛-试题工程0801/试题工程/run.bat') # sys.argv = ['gameclient.bat', b'1515', b'127.0.0.1', b'6001'] # time.sleep(3) if len(sys.argv) != 4: print("The parameters has error. (TeamID server_ip server_port)") exit() team_id = sys.argv[1] server_ip = sys.argv[2] port = sys.argv[3] print("start client....................") print(team_id) print(server_ip) print(port) if team_id.isdigit() and port.isdigit(): team_id = int(team_id) port = int(port) else: print("team_id and port must be digit.") exit() constants.team_id = team_id client.start(server_ip, port)
def main(): print(sys.argv) # 本地测试 # sys.argv = [b'gameclient.bat', b'1112', b'127.0.0.1' ,b'6001'] if len(sys.argv) != 4: print("The parameters has error. (TeamID server_ip server_port)") exit() team_id = sys.argv[1] server_ip = sys.argv[2] port = sys.argv[3] print("start client...") if team_id.isdigit() and port.isdigit(): team_id = int(team_id) port = int(port) else: print("team_id and port must be digit.") exit() constants.team_id = team_id client.start(server_ip, port)
# encoding:utf8 ''' 入口方法,选手不关注 ''' import ballclient.service.constants as constants from ballclient.comunicate import client import sys import os if __name__ == "__main__": print sys.argv if len(sys.argv) != 4: print "The parameters has error. (TeamID server_ip server_port)" exit() team_id = sys.argv[1] server_ip = sys.argv[2] port = sys.argv[3] print "start client...................." if team_id.isdigit() and port.isdigit(): team_id = int(team_id) port = int(port) else: print "team_id and port must be digit." exit() constants.team_id = team_id client.start(server_ip, port) os.system('pause')