Logic Machine Forum
Serial Library query - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Serial Library query (/showthread.php?tid=3732)



Serial Library query - BrentW - 07.12.2021

Hi All,

I was reviewing the openrb serial library documentation over the last few days.
I have often used the .flush() command as i see is commonly used with the examples on here for rs-485 scripting.
I note the .drain() command in the documentation. I have never used this function and the documentation is a little vague.

Could anyone elaborate on how the .drain() call is best used?

regards,
Brent


RE: Serial Library query - admin - 08.12.2021

drain() waits until the data has been sent to the port. Usually you don't need to call it all. On some really old versions drain() call was needed before close() otherwise some data could be lost. Now close() will call drain() before closing the port.