Main Content

Discover Available Data Access Servers


To interact with an OPC server, you need two pieces of information:

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

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

Your network administrator will be able to provide you with the hostnames for all computers providing OPC servers on your network. You may also obtain a list of server IDs for each host on your network, or you can use the toolbox function opcserverinfo to access server IDs from a host, as described in the following section.

Determine Server IDs for a Host

When an OPC server is installed, a unique server ID must be assigned to that OPC server. The 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 the same machine.

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

info = opcserverinfo('localhost')

info = 
                 Host: 'localhost'
             ServerID: {1x4 cell}
    ServerDescription: {1x4 cell}
     OPCSpecification: {'DA2'  'DA2'  'DA2'  'DA2'}
    ObjectConstructor: {1x4 cell}

The fields in the structure returned by opcserverinfo provide the following information.

Server Information Returned by opcserverinfo




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


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


Cell array containing descriptive text for each server.


Cell array containing the OPC Specification that the server provides.


Cell array containing default syntax you can use to create an OPC Data Access Client object associated with the server. See Create a DA Client Object for more information.