Sometimes it is desirable to ignore all incoming data while still maintaining the serial port opened. The ser.sinkdata property allows you to do just that.
Set ser.sinkdata to 1 — YES, and all incoming data will be automatically discarded. This means that the on_ser_data_arrival event will not be generated, reading ser.rxlen will always be return zero, and so on. No data will be reaching its destination even in case of buffer redirection. Escape characters, however, will still be detected in the incoming data stream.