App to app communications lazarus / 21-General ---------------------------------------------------------------------- geraldholdsworth · 2021-02-09 13:14 I'm wondering how to go about doing app to app communications, on multi-platform (there's plenty of examples and suggestions on how to go about it under Windows, typically using Delphi). I guess the subject of Drag and Drop out of the application will also come under this too, but I am also thinking about my application receiving data/messages too (beyond the already implemented OnDragFile event for the form). My thoughts were that each OS will handle it differently, unless something has been added to the LCL and I haven't noticed to make this transparent, but we can use the {$IFDEF Windows},{$IFDEF Darwin}, etc. to handle the different cases. I'm using Lazarus 2.0.11 on macOS, and 2.0.10 on Windows and Linux (2.0.0, I think, on Raspbian). Cheers, Gerald. ---------------------------------------------------------------------- MarkMLl · 2021-02-09 14:29 What are you trying to send, and are the apps on the same physical machine? MarkMLl ---------------------------------------------------------------------- PierceNg · 2021-02-09 14:41 I've had success using ZeroMQ to exchange messages encoded as protocol buffers. Both ends are server-side applications running in separate Docker containers, one is FPC, the other one something else. ZeroMQ - https://github.com/DJMaster/zeromq-fpc Protocol Buffers - https://github.com/lalexs75/protobuf-fpc ---------------------------------------------------------------------- Zvoni · 2021-02-09 14:45 Sounds like IPC. SimpleIPC? --> https://wiki.lazarus.freepascal.org/SimpleIPC ---------------------------------------------------------------------- Zvoni · 2021-02-09 14:49 Quote from: MarkMLl on February 09, 2021, 03:29:07 pmWhat are you trying to send, and are the apps on the same physical machine? MarkMLl Huh? How would you Drag-and-Drop on a different physical machine? ---------------------------------------------------------------------- MarkMLl · 2021-02-09 16:15 Quote from: Zvoni on February 09, 2021, 03:49:30 pmQuote from: MarkMLl on February 09, 2021, 03:29:07 pmWhat are you trying to send, and are the apps on the same physical machine? MarkMLl Huh? How would you Drag-and-Drop on a different physical machine? Entirely easily if supported by the OS. Any number of GUI (or TUI) file managers can do it, and surely you remember the mess that OS/2 WPS could get into if you tried dragging an inappropriate "object" between systems. OP raised drag-and-drop, not me, and in order to get a sensible answer he needs to specify what he's expecting to be able to do: transfer things that are basically file-like (large chunks of data of arbitrary size) or simply send messages around to tell different programs to do things. And OP also said that he's got multiple systems with different OSes etc., so it's entirely reasonable to ask whether he expects to be able to transfer data or messages between them. MarkMLl ---------------------------------------------------------------------- geraldholdsworth · 2021-02-09 16:52 Quote from: MarkMLl on February 09, 2021, 03:29:07 pmWhat are you trying to send, and are the apps on the same physical machine? Yes, they are. If it were on a different machine I could, possibly, use TCP or UDP comms? As for what - at the moment it is just data (probably not exceeding ½GB - but done in packets more likely). Overall, just curious. The drag and drop is to save files from my application(s) to the system's file explorer (Windows Explorer, Apple Finder, whatever Linux calls theirs). ---------------------------------------------------------------------- geraldholdsworth · 2021-02-09 16:52 Quote from: PierceNg on February 09, 2021, 03:41:04 pmI've had success using ZeroMQ to exchange messages encoded as protocol buffers. Both ends are server-side applications running in separate Docker containers, one is FPC, the other one something else. I'll have a look - cheers. Gerald. ---------------------------------------------------------------------- MarkMLl · 2021-02-09 17:45 Quote from: geraldholdsworth on February 09, 2021, 05:52:13 pmYes, they are. If it were on a different machine I could, possibly, use TCP or UDP comms? As for what - at the moment it is just data (probably not exceeding ½GB - but done in packets more likely). Overall, just curious. The drag and drop is to save files from my application(s) to the system's file explorer (Windows Explorer, Apple Finder, whatever Linux calls theirs). UDP is OK for "do this" messages but unreliable (no guarantee of single-delivery), SCTP is better but not universally supported, TCP is oriented towards streamed data (large-scale file transfer, web pages and so on). This is not something I've really looked at recently, but an MQ implementation would appear to be a safe bet for comparatively small chunks of data. For big stuff consider what your OSes support- SAMBA, NFS, FTP etc. or even SFTP or FISH. In both cases consider what your authentication and authorisation requirements are: being authenticated at "this" end of an SMB/CIFS link doesn't necessarily mean you're authorised at "that" end. MarkMLl ---------------------------------------------------------------------- Zvoni · 2021-02-09 17:48 Then i want to point to my first answer in post #4 ---------------------------------------------------------------------- geraldholdsworth · 2021-02-09 21:31 Quote from: Zvoni on February 09, 2021, 06:48:41 pmThen i want to point to my first answer in post #4 I've been looking at that. Haven't tried anything just yet - I'll play with it more tomorrow. Cheers, Gerald. ---------------------------------------------------------------------- Kays · 2021-02-09 22:39 Quote from: Zvoni on February 09, 2021, 03:49:30 pm[…] Huh? How would you Drag-and-Drop on a different physical machine?As a sidebar: It’s not inconceivable, there are programs like Synergy, but the “drag-and- drop” implementation would be their duty, so the application doesn’t notice the data’s copied from a different machine.