"""Utility functions for Cinema 4D MCP Server."""
import socket
import sys
import logging
# Configure logging
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s [%(levelname)s] %(message)s',
handlers=[
logging.StreamHandler(sys.stderr)
]
)
logger = logging.getLogger("cinema4d-mcp")
def check_c4d_connection(host, port):
"""Check if Cinema 4D socket server is running."""
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(5)
result = sock.connect_ex((host, port))
sock.close()
return result == 0
except Exception as e:
logger.error(f"Error checking Cinema 4D connection: {e}")
return False