#!/usr/bin/env python print "test" import sys sys.path.insert(0, "..") import socket_connection reload(socket_connection) server = socket_connection.server() while True: for msg, addr in server.receive(): print msg server.send("answer" + msg, addr)
try: import argparse parser = argparse.ArgumentParser() parser.add_argument('-n', '--name', dest='name',help='server name') args = parser.parse_args() name = args.name except ImportError: name = None while not name: name = raw_input("servername: ") if name in (""): print "invalid server name" name = None server_socket = socket_connection.server(name=name) ende = False game_running = False def gameloop(game,save): global ende, Server, server_socket print "starting game" gamedir = os.path.join(os.path.abspath(os.path.curdir),"data","Spiele",game) savefile = os.path.join(os.path.abspath(os.path.curdir),"saves",game,save+".cfg") #datadir = os.path.join(os.path.abspath(os.path.curdir),"data","commondata") Server = server.Server(gamedir,savefile) authentificated = {} random_keys = {} print "started game"
try: import argparse parser = argparse.ArgumentParser() parser.add_argument('-n', '--name', dest='name', help='server name') args = parser.parse_args() name = args.name except ImportError: name = None while not name: name = raw_input("servername: ") if name in (""): print "invalid server name" name = None server_socket = socket_connection.server(name=name) ende = False game_running = False def gameloop(game, save): global ende, Server, server_socket print "starting game" gamedir = os.path.join(os.path.abspath(os.path.curdir), "data", "Spiele", game) savefile = os.path.join(os.path.abspath(os.path.curdir), "saves", game, save + ".cfg") #datadir = os.path.join(os.path.abspath(os.path.curdir),"data","commondata") Server = server.Server(gamedir, savefile)
#!/usr/bin/env python print "test" import sys sys.path.insert(0,"..") import socket_connection reload(socket_connection) server = socket_connection.server() while True: for msg,addr in server.receive(): print msg server.send("answer"+msg,addr)