[fpc-pascal] Using Serial in a TCP/RS232 gateway, how to set buffer sizes?

Marc Santhoff M.Santhoff at web.de
Wed Sep 6 23:21:17 CEST 2017


On Mi, 2017-09-06 at 23:06 +0200, Bo Berglund wrote:
> On Wed, 06 Sep 2017 22:52:12 +0200, Bo Berglund
> <bo.berglund at gmail.com> wrote:
> 
> >I have now added extra binary logging to the relaying program only to
> >find that the data received and processed are missing about 50 k of
> >the 1M transmission.
> >Next I will edit serial.pp and up the buffers from 2K to 60K or so.
> 
> By the way:
> I have sent the Delphi test program I am debugging over to people at
> the remote location and they have connected their laptop directly to
> the data system and with that setup there is no data loss.
> So this leaves me with only the Lazarus/FPC network relaying app to
> fix...

Could that be some sort of timeout?

You're setting

  FTcpComm.ReadTimeout := 30;

but I have no idea what order of magnitude this 30 is. Maybe streching
the timeout a little bit can help?

I had several cases of timeout problems using RS232 over TCP.

> I could also create another test program, a serial sniffer that could
> be set up to just log whatever appears on the serial lines. I need a
> 3-way cable for that of course.

Such thing does exists, I only forgot the name(s), ;)

HTH,
Marc





More information about the fpc-pascal mailing list