Socket Server API
TCP server for receiving and executing JSON automation commands remotely.
start_autocontrol_socket_server
- start_autocontrol_socket_server(host='localhost', port=9938)
Starts a threaded TCP server that accepts JSON automation commands.
- Parameters:
host (str) – Server hostname. Defaults to
"localhost".port (int) – Server port. Defaults to
9938.
- Returns:
The server instance. Check
server.close_flagto detect shutdown.- Return type:
The server can also read
hostandportfrom command-line arguments (sys.argv[1]andsys.argv[2]).
TCPServer
TCPServerHandler
- class TCPServerHandler
Request handler for the TCP server.
Receives up to 8192 bytes per request, decodes as UTF-8, and processes:
"quit_server"– shuts down the server.Any other string – parsed as JSON and passed to
execute_action(). Results are sent back to the client, terminated by"Return_Data_Over_JE".