Recent

Author Topic: TConsoleIO - pipe/IPC  (Read 345 times)

jcfaria

  • New member
  • *
  • Posts: 16
TConsoleIO - pipe/IPC
« on: May 25, 2019, 02:34:25 pm »
Hi,

Andrey Sevast'yanov created for Delphi 7 a very useful class: TConsoleIO.

Link to ConsoleIO in GitHub: https://github.com/jcfaria/ConsoleIO

According to Andrey, it was originally designed to enable communication between applications written in Delphi and chess engine games, but he already stated which could have other uses.

Under Windows this class enables the communication of a Delphi program with other applications on the same computer (written in Delphi or in other languages) sending and receiving messages quickly, efficiently and securely. All specification and control is done by the application side in Delphi. That is, a Client/Server structure is not required.

This class has been used in the OpenSource Tinn-R project to establish a pipe connection between Tinn-R.exe and Rterm.exe for many years, seamlessly traversing the evolution of the Windows operating system (NT, XP, Vista and 10) and the R (link_1) environment about more than 10 years.

The Tinn-R project (WebSite (link_2), SourceForge (link_3) is migrating from Delphi 2007 to new platforms: Delphi 10.2 Tokyo, Delphi 10.3 Rio and Lazarus 2.0.2 (Free Pascal).

Recently a update of the TConsoleIO class for Delphi XE2 (link_4) was found. The original files - from Delphi 7 (link_5) and to XE2 (link_4) - are in the TConsoleIO folder.

From both projects (Andrey and update to XE2) some basic adjustments have been made. This way, without the need to install the component, it is possible to compile and run the test application (test_platform) in the following versions of Delphi: Delphi 2007, Delphi 10.2 Tokyo and 10.3 Rio. There is also a first attempt for FreePascal under the Lazarus IDE.

To FreePascal the test application is compiling but is not running well yet. Thus, I hope that more advanced users in this area of programming (IPC/pipe) can make their contribution by correcting some problems encountered. I think this will be of great use to many Delphi/FreePascal programmers.

link_1: https://www.r-project.org
link_2: https://nbcgib.uesc.br/tinnr/en/
link_3: https://sourceforge.net/projects/tinn-r/
link_4: https://www.developpez.net/forums/d1538860/environnements-developpement/delphi/adaptation-xe2-composant-mu-console/
link_5: https://torry.net/authorsmore.php?id=6135

All the Best,
« Last Edit: May 26, 2019, 01:58:20 am by jcfaria »

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7298
Re: TConsoleIO
« Reply #1 on: May 25, 2019, 03:28:39 pm »
Looks like a TProcess, but then with thread inside to make it more asynchronous.
(Actually it spawns three threads, seems somewhat wasteful).

Still, great object for studying. Maybe a similar extension can be made to tprocess.

jcfaria

  • New member
  • *
  • Posts: 16
Re: TConsoleIO
« Reply #2 on: May 26, 2019, 12:13:15 am »
Hi.
I have good news: with some corrections, TConsoleIO started running under Free Pascal and Lazarus! The project has been updated in GitHub.

It can be improved, but the basics are already working well.

Best,
J.C.Faria

jcfaria

  • New member
  • *
  • Posts: 16
Re: TConsoleIO - pipe/IPC
« Reply #3 on: May 26, 2019, 01:25:14 pm »
With the Free Pascal/Lazarus project, I am having problems with Latin characters (TConsoleIO.png):

é - ?
ê - ?
í - ?
â - ?
çã - ??
çõ - ??
...

Can anyone with more skill with Free Pascal/Lazarus help?

Best,
« Last Edit: May 26, 2019, 01:30:25 pm by jcfaria »