delphidelphi-2010dcom

DCOM needs to register server on both client and server computer


I have written in Delphi 2010 a DCOM server and a client to call the server. To be able to run the client on a different machine than the server's machine, I need to register the server on both machines, beside to do the security related things to allow the client to access the server.

I am wondering if there is someone to know the way that needs the minimum effort to use a client and a server on two different machines, supposing that both of client and server are written and they are working. What I got so far is as follows:

  1. run the server.exe on server machine: server.exe /regserver
  2. run DCOMCNFG and set the security settings on server machine.
  3. define incoming rules in firewall to let the connection on server machine.
  4. run the server.exe on client machine: server.exe /regserver
  5. now we can run the client.exe on client machine and use the server's implemented interfaces.

What pushed me to write this question is that I can't understand why we need to register the server on client machine also. The client application know about the interface and server GUIDs and use them accordingly when creating the server in its implementation. So the DCOM on client machine has enough information to query the DCOM of the server machine to provide it with the correct server having the provided GUID, and we do not need to register server on client side (at least as it seems), but we need to actually do it.

best regards,


Solution

  • Actually you don't have to register the server on the client machine. However, you might need to register the server Type library on the client machine. You have 2 options:

    1. Register the server's type library on the client machine

    2. Create a DataSnap Server application (COM-based) and use DCOMConnection, SocketConnection or SOAPConnection to connect to it without registering the server nor the type library on the client machine.

    I've developed several COM/COM+ servers in the last 15+ years. My recommendation is: Create a DataSnap COM Based servers and save yourself a lot of headache when deploying your COM server and client. It is much easier to deploy and maintain.