xTool P2 hangs during processing

I have been dealing with a similar problem. After several months of experimentation and troubleshooting, I may have finally determined the cause.

My xTool P2 would often freeze during long engraving jobs using Lightburn, but not when using the xTool XCS software. Through trial and error, I found that if the computer that sent the job to the P2 goes to sleep or disconnects from the device, the P2 will immediately halt. This is true over WiFi or wired Ethernet (I have not tested USB). Using Wireshark, I was able to capture LAN traffic between my computer and the P2. I saw that after the job data was fully transferred (which usually takes a few seconds to a few minutes at most), there continued to be a steady flow of TCP Keep-Alive and TCP Keep-Alive ACK packets at regular intervals every few seconds. As soon as these packets stop, so does the laser cutter operation.

As far as I can tell, xTool’s XCS software simply prevents the computer from sleeping while it is running. I encountered this problem in the past when I accidentally left the XCS application open, and realized the next day that my computer screen had been on for an entire night. I originally thought this may have been a bug in their software, then realized it was an intentional feature to make sure that the laser cutter does not halt during operation.

Earlier on I was convinced that the problem had something to do with the size or duration of my engraving jobs (overloaded buffer, or something like that). But since I figured out the TCP Keep-Alive thing, I have not had any problems with even three hour long jobs running smoothly from start to finish. It was just a matter of probability—the longer the job, the more likely it was that my computer would be left idle and go to sleep while the job was running.