Please note: It is always recommended to test your application with a local OPC server first, because connecting OPC clients to remote servers is the most taxing problem faced by many OPC developers. If your application works with a local OPC server, it must also work with a remote OPC server!
If your application works with a local OPC server, but not with a remote OPC server, the cause is definitely a DCOM configuration problem. |
If your client PC is "OPC free", you need to install the OPC Core Components first. You can download the "OPC Core Components" installation program at the OPC Foundation (Resources/Sample and Tools/Classic). The direct link is
https://opcfoundation.org/developer-tools/samples-and-tools-classic. (a short registration is required).
However, if you want to connect to a remote OPC server, it is recommended to use the ClassId e.g {13FBEFCD-AF85-4AA6-8A6B-394230901A0A} instead of the Server's ProgId (e.g. dOPCSim.Kassl.Simulation) in the ServerName property of the TdOPCDAClient class. To retrieve the ClassId of your OPC Server you can use the property Items[0].ServerClsId from the TdOPCServerBrowser class or our dOPC Explorer (Dialog -> New Server (copy and paste is supported)).
Before you can connect to a remote OPC Server you need to configure Microsoft DCOM on both client and server.
Client-side:
Call the <dOPCInitSecurity> method at the beginning of your client program. That's usually all you have to do here.
Server-side:
To configure the remote OPC server and to understand the dOPCInitSecurity background I recommend the following websites:
Kepware: https://www.kepware.com/en-us/support/resource-library/
Connectivity Guides-> Remote OPC DA Quick Start Guide (DCOM)
Software Toolbox: https://www.softwaretoolbox.com/dcom/html/dcom_.html
Kassl GmbH Copyright © 2023. All rights reserved.
|