Data over TCP/IP lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- JJJ · 2022-10-15 07:38 We have an ancient monitoring software that has been slightly updated over the years. Now I would like to add a remote reading option to it. The collected data should be sent over TCP/IP and the user should be able to read the data using any terminal software. The application is a console software that runs on a Linux computer and it collects 25-30 packets to transmit approximately every 20 seconds. How to send data via TCP/IP in Lazarus so that it can be read on another computer? Socket?? ---------------------------------------------------------------------- domasz · 2022-10-15 09:00 Use Indy sockets: https://forum.lazarus.freepascal.org/index.php/topic,43836.msg307353.h tml#msg307353 ---------------------------------------------------------------------- MarkMLl · 2022-10-15 09:17 Quote from: JJJ on October 15, 2022, 09:38:59 amWe have an ancient monitoring software that has been slightly updated over the years. Now I would like to add a remote reading option to it. The collected data should be sent over TCP/IP and the user should be able to read the data using any terminal software. The application is a console software that runs on a Linux computer and it collects 25-30 packets to transmit approximately every 20 seconds. How to send data via TCP/IP in Lazarus so that it can be read on another computer? Socket?? Assuming that your description is accurate and that it really is a no- frills program dumping data to stdout, look for the Linux Modem sharing mini-HOWTO https://tldp.org/HOWTO/Linux-Modem- Sharing/index.html MarkMLl ---------------------------------------------------------------------- Warfley · 2022-10-15 14:53 The easiest way is not to write the networking code yourself but to simply use Unix tools. Just print the data to stdout (e.g. via writeln) and then you have multiple possibilities. You could use netcat to send the output directly to a server via exp. Or you could just run that in a pseudoterminal session like screen and have the user connect to it (e.g. via ssh) I would do the latter, just run the program in a screen or tmux session and then configure an ssh user such that their login shell is dumping that session ---------------------------------------------------------------------- MarkMLl · 2022-10-15 19:30 Quote from: Warfley on October 15, 2022, 04:53:09 pmThe easiest way is not to write the networking code yourself but to simply use Unix tools. Just print the data to stdout (e.g. via writeln) and then you have multiple possibilities. You could use netcat to send the output directly to a server via exp. Or you could just run that in a pseudoterminal session like screen and have the user connect to it (e.g. via ssh) I would do the latter, just run the program in a screen or tmux session and then configure an ssh user such that their login shell is dumping that session Hence the link I posted. I'd add though that I find the netpipes utilities a bit better behaved than netcat, which I've found in the past to be a bit of a dodgy daemon. "Screen" of course refers to "Gnu Screen", and I agree that it's something of which every practitioner should be aware. However I'd caution about using an SSH login etc. in this context: some years ago I came across a cautionary tale relating to a restaurant ordering program that somebody'd knocked together using Windows NT: whenever a remote user connected he found himself at a Windows guest prompt with a supplied username and password. MarkMLl ---------------------------------------------------------------------- JJJ · 2022-10-16 09:25 Quote from: MarkMLl on October 15, 2022, 11:17:24 am Assuming that your description is accurate and that it really is a no- frills program dumping data to stdout, look for the Linux Modem sharing mini-HOWTO https://tldp.org/HOWTO/Linux-Modem- Sharing/index.html MarkMLl Thanks to everyone! The original program was made with Turbo Pascal and the connection was established via the Centronics bus. Then rewritten with Lazarus (or free pascal) sometime 15 years ago and updated to use RS422. The device itself that sends data out uses ethernet since last year and we'd like to get data out remotely without any converters or serial hardware. In other words change the program to send data out via tcp/ip instead of rs422/232. ---------------------------------------------------------------------- MarkMLl · 2022-10-16 09:27 Quote from: JJJ on October 16, 2022, 11:25:08 amThe original program was made with Turbo Pascal and the connection was established via the Centronics bus. Then rewritten with Lazarus (or free pascal) sometime 15 years ago and updated to use RS422. The device itself that sends data out uses ethernet since last year and we'd like to get data out remotely without any converters or serial hardware. In other words change the program to send data out via tcp/ip instead of rs422/232. Which isn't what you asked for. Well, I reckon you've got quite a job on your hands, starting off with working out what format commands the device expects. Xref to https://forum.lazarus.freepascal.org/index.php/topic,61065.msg 458401.html MarkMLl