PORTS Forum
Ports and Interfaces => Serial Ports => Topic started by: GlennP on January 20, 2012, 07:37:28 am
-
Hi All,
Trying to bomb proof a bit of software in C# and am trying to ensure the buffer is not holding any nasty's I have done a:
myComPort.DiscardOutBuffer();
When opening the port but am now looking to flush the buffer before a command is sent. Is
myComPort.DiscardOutBuffer(); the correct way as I have seen
mention of a Flush command on MSDN is this seen as the better way or is DiscardOut the way to go?
Glenn
-
It depends on what you want:
SerialPort.DiscardOutBuffer Method
Discards data from the serial driver's transmit buffer.
SerialPort.Flush Method
Sends any data waiting in the send buffer of this SerialPort and clears the buffer.
Jan