Main Content

Discover Available HDA Servers

Prerequisites

To interact with an OPC server, you must provide:

  • The host name of the computer on which the OPC server is installed. Typically the host name is a descriptive term (such as 'plantserver') or an IP address (such as 192.168.2.205).

  • The server ID of the server you want to access on that host. Because a single computer can host multiple OPC servers, each server installed on that computer is given a unique ID during installation.

Your network administrator can provide the host names for all computers with OPC servers on your network. You can also obtain a list of server IDs for each host on your network, or use the opcserverinfo function to access server IDs from a host, as described next.

Determine HDA Server IDs for a Host

When an OPC server is installed, it must be assigned a unique server ID. This server ID provides a unique name for a particular instance of an OPC server on a host, even if multiple copies of the same server software are installed on that same machine.

To determine the server IDs of the OPC servers installed on a host, call the opchdaserverinfo function, specifying the host name as the only argument. When called with this syntax, the function returns a structure containing information about all the OPC servers available on that host:

info = 
1x4 OPC HDA ServerInfo array:
 index    Host     ServerID                    HDASpecification            Description                   
 ----- ---------  ---------------------------------  --------  ------------------------------------------------
  1    localhost  Advosol.HDA.Test.3                 HDA1      Advosol HDA Test Server V3.0
  2    localhost  IntegrationObjects.OPCSimulator.1  HDA1      Integration Objects OPC DA DX HDA Simulator 2
  3    localhost  IntegrationObjects.OPCSimulator.1  HDA1      Integration Objects' OPC DA/HDA Server Simulator
  4    localhost  Matrikon.OPC.Simulation.1          HDA1      MatrikonOPC Server for Simulation and Testing

The fields in the structure returned by opchdaserverinfo provide this information:

Server Information Returned by opchdaserverinfo

Field

Description

Host

Character vector that identifies the name of the host. Note that no name resolution is performed on an IP address.

ServerID

Cell array containing the server IDs of all OPC servers accessible from that host.

HDASpecification

Cell array containing the OPC Specification that the server provides.

Description

Cell array containing descriptive text for each server.