title: How to find out if my COM port has recieved XOFF?
body: <p>I am testing code for serial port communication. I am using synchronous IO for now to keep things simple. I have observed that when the PC recieves XOFF the program pauses, no more printing in the console window. When the program recieves XON it starts running again.</p>
  
  <p>What method exists to find out if my program's serial port has earlier recieved XOFF (regardless of synchronous and asynchronous IO) since the COM port driver shall prevent the port from sending any characters out in this case and I better check if XOFF was recieved before calling writefile().</p>
  
  <p>I think that one way is to use the ClearCommError() with COMSTAT struct. Is this the only way? I get this impression by reading <a href="https://msdn.microsoft.com/en-us/library/ff802693.aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/ff802693.aspx</a>
  If that is so, it certainly appears a strange way of doing that.</p>