[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:32:55 CEST 2017

On Wed, 06 Sep 2017 23:21:17 +0200, Marc Santhoff
<M.Santhoff at web.de> wrote:

>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.

No, the Tcp/IP part is not involved at all here. When the transfer to
the server starts there is no response expected until all data have
been transferred.
The problem is that the Win7 application sends RS232 data out a serial
port and another application (my relayer) is using another serial port
which is connected by wire to the first serial port.
This relaying application seems to lose incoming data, which are sent
at a speed of 38400 baud.
Before the data arrives to the TCP/IP part they have been corrupted.
The test on location proves that the case where the relayer is not
involved (wire goes from Win7 application directly to the data system)
is working fine.
But I cannot use that because I am in Sweden and the data system is in

before I wrote my own relaying application in Lazarus I tried to find
something for Windows on-line like ser2net for Linux, which I use in
the receiving end on a Raspberry Pi. But I had no success.
The connection to the remote system goes via a VPN tunnel from my Win7
computer so I cannot use a Raspberry Pi in my end to handle the
relaying. It does not see the remote network...

Bo Berglund
Developer in Sweden

More information about the fpc-pascal mailing list