I would like to create a small server program, which is capable of communicating with a data collection system using RS232 on one side and a network client on the other side. All data should be passed as-is between the endpoints.
So I figured I could use a TIdTcpServer component for the network side (Indy10) to which the remote unit could connect.
Then I also need some serial component to talk to the data collection unit with, and here I don't really know what would be a proper choice.
In any case this "server" application would sit idle listening for a TCP connection on say port 10001.
When a connection is made then it would open the serial port towards the data collection unit and start waiting for data in both directions. In fact the serial port might be open all the time the program runs because this is a fixed installation application...
Anything coming in on the TCP port should be sent to the serial port and anything coming in from serial should be sent back to the TCP client.
There is to be no handling of any protocol whatsoever,
ALL bytes must be transferred
exactly as received.
The target is Linux, either on PC hardware or on a Raspberry Pi unit.
On a Windows PC target I would have used Delphi where I have Turbo AsyncPro available for the serial port. But AsyncPro is not available for FreePascal so I am at a blank here.

Is there existing code already available somewhere that can accomplish this?
Otherwise what are your suggestions?
I have read
this example of port forwarding TCP <=> TCP and it is instructive, but it does not deal with the serial port at all and this seems to be the hard part....