Quote Originally Posted by DataMiser View Post
I haven't used the receive threshold in a very long time. I find that setting it to 0 and using a timer to check the inbuffer has been more reliable going back as far as VB5 and not just with the MSComm controls but 3rd party tools as well. I also never clear the port buffer during a receive. I always read all the data that is there, que it up in a var until it is a complete packet or whatever I am expecting and if there is garbage I then discard the garbage after reading it out of the buffer.

Sounds like either you are getting some unexpected characters or the second packet is begining to arrive while you are trying to read the first one, in which case clearing the buffer could have very adverse side effects.
i always set it to 1. the code i created sort of does what you are suggesting. when the rcv handler fires i queue the number of bytes available. i then have another set of routines that put the data back together in the format the user wants. so in the case of this poster he would request 38 bytes and if there were 38 bytes he would get them. if not he would get a zero length buffer.

the routines can be called from a loop, timer, or delegate.