I am using Delphi 5 and my final code will have to run on Windows 2000, XP and 2003. The project that I am working on has a deadline so I can't take much time for complex, time-consuming solutions.
I have the following situation. I need to convert an existing project into a more modernised version. Basically, part of it will become a Windows service and another part will be either a normal application or a control panel application. And it would not be so hard to do if it weren't for the fact that all parts heavily rely on each other.
First of all, the service(s)... The services will be responsible for managing all data to and from it's storage. Unfortunately this isn't some normal database or even a simple file but involves connecting to some special hardware that is connected to the system. What is important here is that the service keeps track of the hardware status even if no application is active.
The hardware that is connected to it (A PBX system) might be generating events that are captured by the service. But the service itself can also send special commands to the hardware. It is expected that there will be a lot of traffic between the service and the hardware. The technique used for this traffic however varies, from serial port to USB to TCP/IP depending on the type of hardware.
There will be several different applications that want to communicate with the hardware and they all have to go through the service. No application will be allowed to bypass the service to connect to the hardware. So, this brings this description to the conclusion and to my questions...
I know there are quite a few techniques to arrange the communications between service(s) and applications but I'm looking at the easiest way to implement a very reliable environment. Robustness is important, especially for the service.
My first idea was using TCP/IP and then define my own protocol to communicate between apps and service. But I don't like this solution that much because it's a bit vulnerable. A firewall could accidently block the traffic and worse, a sniffer could monitor the communications which might result in unwanted situations.
I've considered using named pipes and mailslots, which are a bit more practical but like with TCP/IP I would have to marshall the data myself before sending it from A to B. There will be hundreds of methods in the service that need to be called thus I would need to write lots of code to marshall and unmarshall data.
Another solution I've come up with would make life a lot easier would be the use of plain old COM objects. Even better, all the service would have to do is create one or more COM objects and the applications will have to use these existing COM objects. This would in fact solve my problem of marshalling data since COM will do this for me. And no, no DCOM. Just plain COM.
Of course there would be many other options too but I like the COM idea. Does anyone have some good experience with this or would you advise some other solution? I would like to see a demo of my suggestion, i.e. a service, COM component and one or more applications communicating with each other. Do they exist?
In other words, any advise?