08.12.2021, 10:01
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.