To ensure a stable connection, follow these steps provided by XPrintertech and the XPrinter Driver Setup Guide :
Python example using built-in REST API (port 49512): Random Data Receipt Printer Driver Software V8.3