What's your practice? Have you ever needed for two of your Delphi applications to communicate? Why? How do you send information between your Delphi applications? What do you send? Let us learn something new from your experience - give us some real world examples.
Avoid Synchronize method
- Many threads send message to main VCL thread that receive and execute visual tasks avoiding use of Synchronize method.
- —Guest Claudio
Windows messages, UDP and TCP, ODBC
- I made a monitoring tool for a server app that uses a database to store all of its I/O data and logs. The monitoring tool had a lot of weird requirements: connect via ODBC to the server to receive the status and params of the server; support multiple servers per seat; support connection through proxies; one server could be monitored by one or more people (working as a team). So in the end, the solution was the following: The main app that shows the various params and status for each server the user is responsible; Another smaller app that connects to the server via ODBC (proxifyed using FreeCap); this app sends the info to the main app via windows messages; there can be any number of this app running (output to the main app is Identified by the server ID); also this app receives messages with commands to be issued via ODBC; The main app communicates with other people from the same team (monitoring the same server(s) via UDP and TCP).
- —Guest BlueVD
- I created my own "FaceTime" commu nications with udp server and client streams. I use two udp components, one for sound and the other one for the image. Works great! :)
- —Guest Didos007
- A program in a certain PC with Camera takes photos of products, and another program running on that reads letters from those images and send the result to anther PC.... There are several PCs taking photos of products and recognizing letters and send information via socket communication to a Control PC.. and the Control PC stores data on DB and send to UI programs running on other PCs via socket communication...
Just inside of my applications
- I have not had any comunication with any other application. Just inside of my applications.
- —Guest esmaeil bahmyari
- To let the host app know that my app is running and vice versa
- Data from cash registers to Delphi Applications; from other Applications like Tensai2000 communication program of uniwel cash registers.
- —Guest Isidro M. Lahora
I Use Asta/Sockets
- Built an entire advertisement platform for cybercafes using Asta/Sockets. I send huge amounts of compressed ads(images) and other info from ad servers to clients machines in a asynchronous way. Works very well
- —Guest Gath
HTTP / WebService
- Indy components make easy to handle HTTP server embbeded in application ; so wee use that. Write and read from/to Sockets sucks, and are too low level work ! The use of WebService allows us to exchange real objects (OOP) between two applications so that you don't have to serialize objets !
- —Guest FreeBen
windows messages and midas
- Our application has a core component and multiple application components that all communicate with the core. We use windows messaging (user-defined) to send announcements / commands between the core and the applications. We use Midas, with a tDCommConnection in each application for more complex data transfers and remote calls. We also use the tClientDataSet to access file-based local data that is periodically synchronized to data in the remote data base
- I am old fashioned (and I think the only one). I use a lot of file communication where the data can be inside the file and/or on its name.
Sockets & Windows Messages
- We have used both. Sockets mainly for intermachine communications and Windows messages when only simple (and local machine)communications are needed.
- —Guest ct
- Sockets with Indy Components, sometimes xmlrpc. Its always best to keep it abstract so that one day when you have to switch to something not-Delphi its not a PITA. I always run away (as fast as possible) from memory mapped files/pipes/windows messages.
- —Guest crazy
Memory Map files
- I prefer to use Memory Map Files. Using this is a bit odd but still usable with a some of work.
- —Guest Yogi Yang
- Memory-mapped files, pipes, sockets. For simple sending of command line parameters, I found JclAppInst unit from the JCL (http://jcl.delphi-jedi.org/) useful. When you need to execute code in another process, a quite nice way (IMHO) is to use DataSnap. Local (same process), Socket and HTTP transports are already provided. I've written a memory-mapped file transport and now I can switch between these at runtime as needed, to use memory-mapped files across processes for the local computer, sockets or HTTP for remote computers (these require a socket server and a web server, respectively, to be running on the target computer). The client (calling) code remains the same. Because of the type library generated Pascal code, it's type-safe (checked by the compiler). An example of why you would need to split your executables into two separate processes is if they need to run under different user accounts, I've blogged about it here: http://tondrej.blogspot.com/2007/06/datasnap-to-rescue.htm
- —Guest tondrej