Recently I have spent some time talking about DDE – Dynamic Data Exchange. DDE is one of the fundamental communication methods that have been around since the time when Bill Gates was only a Millionaire.
But DDE is only one of many ways to move data between processes. There are a number of other ways to move data between Windows processes. Here’s a few of the other Inter-Process Communication mechanisms:
THE CLIPBOARD – Yes, the tool that you use daily to copy text or numbers from one application or another is really an Inter-Process Communication mechanism. The Clipboard has a set of data formats that it understands and can deliver data stored in its buffers to another application which can either accept it as is or modify it as needed for its purposes. In some ways, the Clipboard is a poor man’s DDE. It supports the same data types as DDE though it is generally used for one time operations while DDE provides ongoing communications.
DATA COPY – Two Windows processes can use the Windows messaging system to pass known data via direct function call using the wm_copydata function. This works well for two highly integrated applications where both processes understand the data.
FILE MAPPING – File mapping is a little heard of mechanism that treats the contents of a file as shared memory. Processes can read or modify the data in the file directly using pointers in their local address space. Of course, semaphores or other mechanisms are required to prevent data corruption in a multi-tasking environment.
MAILSLOTS – Mailslots are an easy way for two processes to communicate when they have intermittent messages to send and receive. A process initiates a Mailslot server that buffers messages from Mailslot clients. A process can define the maximum number of Mailslot buffers and the maximum messages size that is can process.
REMOTE PROCEDURE CALL (RPC) – RPC is another old communication mechanism that is a foundation for a lot of other, more well-known, technologies. RPC consists of a client and a server. RPC simply allows a process to invoke a procedure in another process. A Client makes a blocking call (it has wait for completion) to a Server on a local or remote machine. The Call invokes a software service on the destination machine. When complete, the Server responds back to the Client. SOAP (Simple Object Access Protocol) is derived from RPC.
WINDOWS SOCKETS – Windows Sockets is probably the most well-understood of the mechanisms for moving data between remote processes. Sockets provide a standardized, well-understood mechanism for managing connections, maintaining connections and moving unstructured data from one remote node to another.
COMPONENT OBJECT MODEL (COM) and OBJECT LINKING and EMBEDDING (OLE) – COM and OLE provide the facility that allows processes to not only share data but to allow editing of that data in its native application. For example, when you embed a spreadsheet in a Word application, it is OLE that allows you to edit the spreadsheet using Excel and it is COM that provides the standardized representation of the data.
So what does this all mean for us down and dirty Industrial Automation guys? If you are building an HMI or SCADA system (and I know a LOT of you are) there are many ways to move data between processes. You can have processes that access Siemens PLCs, RAs ControlLogix and lots of other devices.
In general, Sockets is going to give you the most efficient, least costly interface if you have the protocol that you need. If not, you are going to have to use some of the technologies that I describe here with shrink-wrapped software packages that may cost you a bunch of money. More on that in a future article.