ARSim 6.3.4 : Service interface communication not documented correctly

Hi Community !

I’m currently trying to communicate with the ARSim service interface to retrieve Status and Execute commands on the my ARSim.

Here is some link to the help:

From the help content, we can communicate using socket stream with the ARSim on the default port 4002. And list of commands to send is basic XML formatted data.

It seems that the help is not up-to date, I checked my listing port for process AR000.exe and the only port listenning (except all other standard ports) is the 4213. So I created a little python script to handle all the commands. Here is the code used:

import socket

class ARsimServiceInterface:
    def __init__(self, host='127.0.0.1', port=4002):
        self.host = host
        self.port = port
        self.socket = None
    
    def connect(self):
        """Establishes a connection with the ARsim server"""
        try:
            self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            self.socket.connect((self.host, self.port))
            return True
        except Exception as e:
            print(f"Connection error: {e}")
            return False
    
    def disconnect(self):
        """Closes the connection with ARsim"""
        if self.socket:
            self.socket.close()
            self.socket = None
    
    def send_command(self, command):
        """Sends a command to ARsim and returns the response"""
        if not self.socket:
            if not self.connect():
                return None
        
        try:
            # Add message terminator if absent
            if not command.endswith('\0'):
                command += '\0'
            
            self.socket.sendall(command.encode('utf-8'))
            
            # Receive response
            response = b''
            while True:
                part = self.socket.recv(1024)
                response += part
                if b'\0' in part or len(part) < 1024:
                    break
            
            return response.decode('utf-8').strip('\0')
        except Exception as e:
            print(f"Error during send/receive: {e}")
            return None
    
    # Basic commands
    def end(self):
        """Command to quit ARsim (the loader continues running)"""
        return self.send_command('<End Command="1"/>')
    
    def restart(self):
        """Restarts ARsim"""
        return self.send_command('<Restart Command="2"/>')
    
    def stop(self):
        """Stops ARsim (same as End)"""
        return self.send_command('<Stop Command="3"/>')
    
    def diagnostics(self):
        """Restarts ARsim in DIAGNOSTICS mode"""
        return self.send_command('<Diagnostics Command="4"/>')
    
    def cold_restart(self):
        """Cold restart of ARsim"""
        return self.send_command('<Cold restart Command="5"/>')
    
    def warm_restart(self):
        """Warm restart of ARsim"""
        return self.send_command('<Warm restart Command="6"/>')
    
    # Status and information commands
    def status(self):
        """Requests ARsim status"""
        return self.send_command('<Status Command="10"/>')
    
    def version(self):
        """Requests ARsim version"""
        return self.send_command('<Version Command="11"/>')
    
    def single_step(self, steps):
        """
        Executes ARsim in step-by-step mode
        steps: number of system ticks to execute (0 to resume cyclic processing, -1 to exit step-by-step mode)
        """
        return self.send_command(f'<SingleStep="{steps}" Command="12"/>')
    
    def query_single_step(self):
        """Requests the number of remaining steps to execute"""
        return self.send_command('<SingleStep Command="13"/>')
    
    def set_time_factor(self, factor):
        """
        Changes the TimeZoom factor
        factor: +3 (as fast as possible), +2 (100:1), +1 (10:1), 0 (1:1), 
                -1 (1:10), -2 (1:100), -3 (1:1000)
        """
        return self.send_command(f'<TimeFactor="{factor}" Command="14"/>')
    
    def get_time_factor(self):
        """Requests the current TimeZoom factor"""
        return self.send_command('<TimeFactor Command="15"/>')
    
    def get_usec_counter(self):
        """Requests ARsim's UsecCounter"""
        return self.send_command('<UsecCounter Command="16"/>')
    
    def get_license_info(self):
        """Requests license information"""
        return self.send_command('<License Command="17"/>')


# Usage example
if __name__ == "__main__":
    arsim = ARsimServiceInterface(host='127.0.0.1', port=4213)
    
    # Connect to ARsim
    if arsim.connect():
        print("Connected to ARsim")
        
        # Request version
        version = arsim.version()
        print(f"Version: {version}")
        
        # Request status
        status = arsim.status()
        print(f"Status: {status}")
        
        time_factor = arsim.get_time_factor()
        print(f"Time factor: {time_factor}")
        
        # Close connection
        arsim.disconnect()
    else:
        print("Unable to connect to ARsim")

When I execute this python script, I got this as output:

Connected to ARsim
Version: {"jsonrpc":"2.0","error":{"code":-32700,"message":""}}
Status: {"jsonrpc":"2.0","error":{"code":-32700,"message":""}}
Time factor: {"jsonrpc":"2.0","error":{"code":-32700,"message":""}}

It seems that the service interface is now using jsonrpc communication, but I didn’t found any documentation in the help about this.

Did someone already use this service interface on ARSim? If someone does, did he got same problem on ARSim 6?

Best regards,
Florent

Ok nevermind it’s not activated by default!
It’s works as expected when using -i flag to enable it.