print(f"🔍 Checking SolidCAM License Server: args.server:args.port")
if not solidcam_lines: return "No SolidCAM licenses found in server output." solidcam license server
# Get license info via CodeMeter print(f"📡 Fetching license list from args.server...") raw_output = get_cm_licenses(args.server) print(f"🔍 Checking SolidCAM License Server: args
print(f"✅ Server reachable.")
# Look for lines containing 'SolidCAM' or 'SolidCAM_CNC' for line in lines: if re.search(r"SolidCAM", line, re.IGNORECASE): solidcam_lines.append(line.strip()) f"/remote=server_ip"] # If on Linux/macOS
def ping_server(host, port): """Check if license server port is reachable""" try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.settimeout(2) result = sock.connect_ex((host, port)) sock.close() return result == 0 except Exception: return False
# Example for Windows (adjust if needed) cmd = [CM_BIN, "/ls", f"/remote=server_ip"] # If on Linux/macOS, use 'cmu' if sys.platform != "win32": cmd = ["cmu", "-ls", "-remote", server_ip] result = subprocess.run(cmd, capture_output=True, text=True, timeout=10) return result.stdout except FileNotFoundError: return "CodeMeter utility not found. Is CodeMeter installed?" except subprocess.TimeoutExpired: return "Timeout: License server not responding." def parse_cm_output(output): """Extract SolidCAM-related licenses from CodeMeter output""" solidcam_lines = [] lines = output.splitlines()