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

Bo Berglund bo.berglund at gmail.com
Thu Sep 7 13:48:27 CEST 2017

On Thu, 7 Sep 2017 10:42:59 +0000, Mark Morgan Lloyd
<markMLl.fpc-pascal at telemetry.co.uk> wrote:

>SerWrite() returns the actual number of bytes it's written, which could 
>be anywhere from the number passed as the parameter down to zero (if 
>hardware handshaking's being used at a lower level). An intermediate 
>value would indicate that a buffer's full somewhere, and that you should 
>adjust your source address and length and have another shot.

But I am losing data in the *receive* end, not while sending back to
As described I am sending 0x0FF000 bytes of data out of the Win7
serial port but only less than a million is counted in the serial
receive end of the relaying program. So too few bytes are sent over
the TCP/IP link.

I think I will have to create a bogus image file where I have a
regular pattern of bytes so I can see when the hickups occur in the
log. In a normal memory file most of the data is zero, so there are
long stretches of zero bytes sent. Therefore it is not easy to see
where the losses occur, I only see that the last part of the file
(which contains some data) has been displaced to lower addresses.

Bo Berglund
Developer in Sweden

More information about the fpc-pascal mailing list