I am sending the FlushInQ to the target port but when I check the GetInQLen. The buffer still having the same amount of data (I run GetInQLen before and after FlushInQ).
I am not setting any signal (CTS, RTS, etc)
I am doing several transactions but must of the time payload is 20 to 32 bytes. Those are numbers of bytes in reading from the buffer before and after sending the FlushInQ command
It has happened to me too to observe some strange behavior of FlushInQ, as it takes some time to flush the queue. In some occasion I replaced it with a dummy ComRd to empty the queue.
I seemed to understand that it is faster than looping and waiting for the queue to be flushed, but it is only vague feeling: I didn't performed appropriate tests to confirm it.
Ok, I asked because, it might be the case that; when you have too many bytes coming in with a high baud rate, your buffer might get fulled up very quickly and you may be reading the in-queue length when the queue is full.
But if it ia just 20-30 bytes, it may be related to Roberto's response. And you can solve it with the workaround he proposed.