Main Content


Query host for installed OPC UA servers



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.

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 object.


collapse all

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

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

   Connection Information:
               Hostname: ''
                   Port: 53530
              Endpoints: [1×11]

   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: 'localhost'

Data Types: char | string

Output Arguments

collapse all

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

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

See Also


Introduced in R2015b