[COM, TCP/IP, Services] Advise, please...

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?
LVL 17
Wim ten BrinkSelf-employed developerAsked:
Who is Participating?
Lee_NoverConnect With a Mentor Commented:
I'd definitively go with RemObjects ... I've used RO for more than a year now and had no problems whatsoever
the transport method can be choosen anytime ... messages (wm_copydata), mailslots, udp, plain tcp, http, email !, direct dll, ...
it's a commercial product but well worth the price (which is not high 300eur)
the learning curve is very steep .. just go over a few examples and you're done .. or even follow an example to create what you need in the first try
I know I've replaced services+dcom (that couldn't get working in 2 weeks) with an example from RO in 2 hours .. it has worked from the first try and ever since :)
Wim ten BrinkSelf-employed developerAuthor Commented:
RemObjects... I've considered them for a short moment but then I have to convince my boss to upgrade to Delphi 6 or 7... Something that would be a bit expensive and might require us to rewrite quite a few things in our current libraries. (Or buy upgrades for these too...) And there will definitely be NO SUPPORT for .NET in this all.

The product I'm working on has two parts... The service is connected to a PBX system (Large telephony box) and monitors everything that is happening on it. So when calls are made, forwarded, disconnected or whatever more, the service responds to it. Now, other applications can be running on the same machine, providing all kinds of services. For example, a call recording application might record calls from certain phonelines. Another monitoring application might just measure the length of phonecalls and maintain a list of calls made. A third application might be sending and receiving faxes. The fourth will just send SMS messages. All in all there could be dozens of applications active and most of them will be running on the same system, although a few might be running on a remote system. The service itself will just have to maintain an overview of the current status of the PXB system and respond to events from the PBX system.

As I said, we already have an existing solution but it doesn't use services. As such it is a bit too fragile. As a service the main module would be more robust. But I need to keep things very simple too, since other developers might have to maintain the code I'm writing. And it's not like a webservice that's just active whenever a request is made. No, the service is continuously active, monitoring the hardware. As if it's a device driver, kicking events to all other applications that are connected to it. Which is why I'm thinking more to a simpler COM approach. Most applications will be running locally anyway. For the remote applications there's already a working solution in our current setup. A local application serving as server, which would become a second service application in the near future. (Thus a client connect to this service, the service to a COM object and the COM object to the second service.)
Wim ten BrinkSelf-employed developerAuthor Commented:
Well, if RemObjects is the best answer I get on my question then I'll have to accept this as the answer. I asked for opinions, I got just one...

Thank you, Lee, for your opinion about the subject. I might not fully agree but hey, I asked for advise and you were the only one giving any. :-)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.