System.IO.Ports.SerialPort.DiscardOutBuffer C# (CSharp) Method

DiscardOutBuffer() public method

public DiscardOutBuffer ( ) : void
return void
		public void DiscardOutBuffer ()
		{
			CheckOpen ();
			stream.DiscardOutBuffer ();
		}

Usage Example

Example #1
0
        public static bool PLCStop(PPIReadWritePara para)
        {
            if (!serialPort1.IsOpen)
            {
                serialPort1.Open();
            }
            PPIAddress ppiAddress = new PPIAddress();

            ppiAddress.DAddress = Convert.ToByte(para.PlcAddress);

            serialPort1.DiscardInBuffer();
            serialPort1.DiscardOutBuffer();

            serialPort1.Write(ppiAddress.StopBytesyte, 0, ppiAddress.StopBytesyte.Length);
            //Thread.Sleep(10);
            string str = ByteHelper.ByteToString(ppiAddress.StopBytesyte);

            if (serialPort1.ReadByte() == 0xE5)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
All Usage Examples Of System.IO.Ports.SerialPort::DiscardOutBuffer