def run(self): while self.allow_processing: try: json_data = messager.recv_msg(self.connection) except Exception as e: print(e) self.client.stop_client() sys.exit(1) server_objects = client_server_tools.unpack_patch(json_data) self.client.update_client_objects_from_server_objects(server_objects)
def run(self): print("Starting player service") while self.allow_work: try: data = messager.recv_msg(self.player_connection) except ConnectionResetError as e: print("Some player disconnected") self.allow_work = False break decoded_data = int(data) # print("recv/input key: " + data) self.player.apply_pressed_key(decoded_data)