On Tue, 20 Jun 2017 09:18:50 +0000, Mark Morgan Lloyd <markmll.fpc-pas...@telemetry.co.uk> wrote:
>I tend to use the lower-level serial.pp unit. The patches I contributed >a couple of years ago specifically added a couple of read-with-timeout >functions. > Mark, thanks for your input! I had a look at the serial unit and I found that there are two overloaded functions SerReadTimeout(): function SerReadTimeout(Handle: TSerialHandle; var Buffer; mSec: LongInt): LongInt; function SerReadTimeout(Handle: TSerialHandle; var Buffer: array of byte; count, mSec: LongInt): LongInt; In the second of them there is a count argument, presumably indicating the number of bytes to read from the port. The first is missing this but sets the value to 1 in the call to ReadFile. Does this mean that it will only read a single byte and return it whereas the second version reads the indicated number of bytes and then returns? I assume that for both there is a return forced when the timeout expires. In both cases the number of actually read bytes are returned in the result. Questions: ---------- Do I have to create a thread in order to constantly monitor the state of the reception? And I could not find a way to set the comm buffer size, what happens if I do not check incoming data for a while when there is an inbound stream. Is there an overflow somewhere? Anyway it looks promising so far, now I just have to find the proper TCP client component to use as the far end of the link. I have used Indy components in the past but I would like something a bit simpler to use... -- Bo Berglund Developer in Sweden _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal