We are facing some problems when trying to flush the input buffer on a serial port. Our unix program is first reading 2 bytes on a serial port onto which a pc is connected, sending us messages. Depending on the value of these 2 first bytes, we may have to ignore the remaining of the message. In such a case we use tcflush to empty the input buffer before reading again. All is ok when we receive short messages (less than 64 bytes), but when receiving bigger messages, it seems that the tcflush call doesn’t empty the input buffer, but flushes only the 64 first bytes. Thus the next read begins at 65th byte of the preceding message.
Did anyone encounter such issue?
Could this be due to some configuration parameter?
Any idea will be welcome