softtouch 9 Posted May 30, 2022 I am looking for some sort of IPC which works cross platform. The purpose is to start other executables from a main program and communicate with them, sending data and receive results for example. It should work on Windows and also on macOS. Unfortunately, I could not finds anything useful. Does anybody has a clue or hint or anything? Share this post Link to post
Anders Melander 1783 Posted May 30, 2022 tcp/ip works on pretty much everything. 3 Share this post Link to post
Fr0sT.Brutal 900 Posted May 30, 2022 Pipes are the best for apps you launch and control. The easiest implementation at the sub app side is just ReadLn/WriteLn Share this post Link to post
softtouch 9 Posted May 31, 2022 I cant get tcp (using Indy) working. On Win is works, running the same on mac, it crash with some error #5. Isn't there somewhere a solution that actually works? Share this post Link to post
Edwin Yip 154 Posted June 1, 2022 I use mORMot for this because calling a method or an interface in another process is just like calling a method/interface in the same process. And the communication protocol can be tcp/ip or named pipes. On process B you define and implement an interface: type ICalculator = interface(IInvokable) ['{9A60C8ED-CEB2-4E09-87D4-4A16F496E5FE}'] /// add two signed 32-bit integers function Add(n1,n2: integer): integer; end; TServiceCalculator = class(TInterfacedObject, ICalculator) public function Add(n1,n2: integer): integer; end; function TServiceCalculator.Add(n1, n2: integer): integer; begin result := n1+n2; end; And you expose it: Server.ServiceRegister(TServiceCalculator,[TypeInfo(ICalculator)],sicShared); On process A, you can now call the above interface served by process B: Client.ServiceRegister([TypeInfo(ICalculator)],sicShared); var I: ICalculator; begin I := Client.Service<ICalculator>; if I<>nil then result := I.Add(10,20); end; More details: https://synopse.info/files/html/Synopse mORMot Framework SAD 1.18.html#TITLE_415 Sample code: https://github.com/synopse/mORMot/tree/master/SQLite3/Samples/14 - Interface based services It's even simpler if you use the so-called "method-based service". Hope it helps. Share this post Link to post
softtouch 9 Posted June 1, 2022 I thought that is only Win/Linux (server). I need to have IPC on macOS, communicating between macOS apps. Share this post Link to post
Edwin Yip 154 Posted June 1, 2022 Oh sorry, overlooked the MacOS requirement... Share this post Link to post
mjustin 23 Posted June 1, 2022 2 hours ago, softtouch said: I thought that is only Win/Linux (server). I need to have IPC on macOS, communicating between macOS apps. Indy runs on many operating systems including Linux. It should also run on macOS. If you get an "error #5", you may find the cause by debugging, to find the location in your application and the actual operation it tries to perform. Share this post Link to post