win32file.PurgeComm

PurgeComm(handle, action)

Discards all characters from the output or input buffer of a specified communications resource. It can also terminate pending read or write operations on the resource.

Parameters

handle : PyHANDLE

The handle to the communications device.

action : int

The action to perform. This parameter can be one or more of the following values.

Value Meaning
PURGE_TXABORTTerminates all outstanding overlapped write operations and returns immediately, even if the write operations have not been completed.
PURGE_RXABORTTerminates all outstanding overlapped read operations and returns immediately, even if the read operations have not been completed.
PURGE_TXCLEARClears the output buffer (if the device driver has one).
PURGE_RXCLEARClears the input buffer (if the device driver has one).