Simple one-way IPC protocol.
uses |
||
System, |
||
|
Various general purpose classes: stack, queue, objectlists. |
|
|
Synchronization objects. |
|
The SimpleIPC unit provides classes to implement a simple, one-way IPC mechanism using string messages. It provides a TSimpleIPCServer component for the server, and a TSimpleIPCClient component for the client. The components are cross-platform, and should work both on Windows and UNIX-like systems.
The Unix implementation of the SimpleIPC unit uses file-based sockets. It will attempt to clean up any registered server socket files that were not removed cleanly.
It does this in the unit finalization code. It does not install a signal handler by itself, that is the task of the programmer. But program crashes (access violations and such) that are handled by the RTL will be handled gracefully.
This also means that if the process is killed with the KILL signal, it has no chance of removing the files (KILL signals cannot be caught), in which case socket files may remain in the file system. However, the client code attempts to cater for this and will remove the stale sockets if it detects them.
Under Windows, the communication is done through WM_COPYDATA messages. Starting from Windows Vista it is forbidden to send messages between service applications and desktop applications, so a SimpleIPC client in a desktop application cannot connect to a SimpleIPC server in a service application and vice versa.