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

Posted on 2004-08-25
Last Modified: 2012-05-05
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?
Question by:Wim ten Brink
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 12

Accepted Solution

Lee_Nover earned 500 total points
ID: 11899966
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 :){364BA043-7A12-4453-8F96-97BDA56BC0E0}
LVL 17

Author Comment

by:Wim ten Brink
ID: 11902285
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.)
LVL 17

Author Comment

by:Wim ten Brink
ID: 12048707
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. :-)

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Downloading email attachments 2 85
Delphi: ForceDirectory plain function 7 50
Dynamically Created Query 3 70
Drag & Drop... Data from one grid to another 2 47
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question