Open LuisLozano opened 6 months ago
Unfortunately this is not possible. On most OSes and device drivers, the native call to write()
used by SerialPort.writeBytes simply passes the bytes to the device driver and returns success to the user, without providing any guaranteed or uniform way to tell the device driver to drop any remaining bytes from its internal buffer. If your communications are truly that slow that they require canceling before the bytes actual make it out onto the wire, you may need to simply write single bytes at a time so that you have full control over when to stop writing.
Is there a way to stop sending bytes once the SerialPort.writeBytes method has been called? I have an application where the user has slow communication using the serial port and there are cases where the user needs to stop the transmission. I am using Linux.