Main Content

opcuaserverinfo

Query host for installed OPC UA servers

Description

example

Sinfo = opcuaserverinfo(HostName) queries the specified host for its installed OPC UA servers. HostName can be a host name or IP address, specified as a character vector or string.

Note

Before running opcuaserverinfo to query a host, you must set up a Local Discovery Service (LDS) on that host, as described in Install a Local Discovery Service for OPC UA Server Discovery.

Sinfo = opcuaserverinfo(DiscoveryUrl) queries the Discovery Service located at the URL DiscoveryUrl. DiscoveryUrl must use the opc.tcp protocol specified by the syntax "opc.tcp://hostname:port/Url". Use the DiscoveryUrl when your server's OPC UA Discovery Service uses a nonstandard port number (by default 4840).

Sinfo is returned as an OPC UA ServerInfo object, or an array of these objects, containing the read-only properties Description, Hostname, Port, and Endpoints. Endpoints contains a list of available endpoints for the server, as an EndpointDescription array. Endpoints includes information about the security models supported by each endpoint and the user authentication available on that endpoint.

Use the opcua function to create an OPC UA client object directly from an opc.ua.ServerInfo object.

Examples

collapse all

Find all available servers on the local host, and view the properties of the first.

Sinfo = opcuaserverinfo('localhost');
Sinfo(1)
OPC UA ServerInfo 'SimulationServer@tmopti01win1064':

   Connection Information:
               Hostname: 'tmopti01win1064.dhcp.mathworks.com'
                   Port: 53530
              Endpoints: [1×11 opc.ua.EndpointDescription]

   Security Information:
    BestMessageSecurity: SignAndEncrypt
    BestChannelSecurity: Aes256_Sha256_RsaPss
         UserTokenTypes: {'Anonymous'  'Username'  'Certificate'}

Create an OPC UA client for the first server found.

uaClient = opcua(Sinfo(1));

Input Arguments

collapse all

Host name or IP address, specified as a character vector or string, identifying the machine running the OPC UA servers.

Example: 'localhost'

Data Types: char | string

Discovery service URL address, specified as a character vector or string in the form 'opc.tcp://hostname:port/Url'.

Example: 'opc.tcp://mydomain.com:4840/UADiscovery'

Data Types: char | string

Output Arguments

collapse all

Server information, returned as an array of opc.ua.ServerInfo objects. Index into the array to access the following individual server properties.

PropertyDescription
HostnameHost name used by server to authenticate connections
PortPort number used for connections to server
EndpointsAvailable endpoints for server
BestMessageSecurityHighest message security mode supported by server
BestChannelSecurityMost secure channel security policy supported by server
UserTokenTypesList of user authentication types supported by server

Version History

Introduced in R2015b