Skip to main content

GetEndpoints

Preliminary / Supporting
  • After dragging it to the Endpoint, use Constructor Actually establish a session.
  • For cross-service discovery, please use FindServers.

Signature​

Static method, defined in DarraOpcUa_Client.OpcUaDiscovery:

public static IReadOnlyList<EndpointDescription> GetEndpoints(
string endpointUrl,
uint timeoutMs = 10_000);
ParametersTypeDefaultNote
endpointUrlstring—Target endpoint, in the form of opc.tcp://server:4840
timeoutMsuint10_000Timeout (milliseconds), default 10 seconds

Send a single request directly to the server GetEndpoints and return the list, No session is required. Single pass TCP → Hello/Ack → OPN(None) → GetEndpoints → CLO.

endpointUrl Thrown when the value is null or an empty string ArgumentNullException; thrown when delivery fails OpcUaException— ex.StatusCode this is returned by the server StatusCode.

EndpointDescription Field​

FieldTypeNote
EndpointUrlstringActual endpoint URL
SecurityModeMessageSecurityModeNone / Sign / SignAndEncrypt
SecurityPolicyUristringAlgorithm Suite URI
ServerCertificatebyte[]Server Certificate (DER)
UserTokensIReadOnlyList<UserTokenPolicy>Supported Login Methods
TransportProfileUristringTransmission Profile (usually UA-TCP)
SecurityLevelbyteServer-Side Recommendation Priority
ServerApplicationUristringServer-Side Application URI
ServerProductUristringServer-Side Products URI
ServerApplicationNamestringServer Application Name
ServerApplicationTypeintServer-Side Application Types

UserTokenPolicy Field​

FieldNote
PolicyIdThe ID provided by the server, which is sent back when the client is activated
TokenTypeAnonymous / Username / Certificate / Issued
Other Token Fields

The type of "Issued" tokens, the issuer endpoint, and the token's encryption policy are SDK not currently supported.

Usage​

using System;
using DarraOpcUa_Client;

var endpoints = OpcUaDiscovery.GetEndpoints("opc.tcp://server:4840");

Console.WriteLine($"Server has {endpoints.Count} endpoints:");
foreach (var ep in endpoints)
{
Console.WriteLine($"\n URL: {ep.EndpointUrl}");
Console.WriteLine($" Mode: {ep.SecurityMode}");
Console.WriteLine($" Policy: {ep.SecurityPolicyUri}");
Console.WriteLine($" Tokens:");
foreach (var t in ep.UserTokens)
Console.WriteLine($" - {t.TokenType} (PolicyId={t.PolicyId})");
}

Sample Output​

(The following PolicyId is a string published by the server itself; the value varies depending on the server.)

Server has 3 endpoints:

URL: opc.tcp://server:4840
Mode: None
Policy: http://opcfoundation.org/UA/SecurityPolicy#None
Tokens:
- Anonymous (PolicyId=anonymous)

URL: opc.tcp://server:4840
Mode: Sign
Policy: http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256
Tokens:
- Anonymous (PolicyId=anonymous)
- Username (PolicyId=username)

URL: opc.tcp://server:4840
Mode: SignAndEncrypt
Policy: http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256
Tokens:
- Username (PolicyId=username)
- Certificate (PolicyId=certificate)

The server typically exposes multiple combinations (None / Sign / SignAndEncrypt× Anonymous / Username / Certificate), and the client selects the appropriate one based on its needs.

Exception​

ExceptionTrigger Conditions
ArgumentNullExceptionendpointUrl null / empty string
OpcUaExceptionIf the call returns neither a value nor an exception StatusCode.Good, that StatusCode is the server's return value.

OpcUaException.StatusCode Which type is "Unspecified"? — It could be a network connection issue, the server not supporting Discovery, or a timeout. Use "On Demand" to display VersionInfo.StatusName(ex.StatusCode) the specific name.

Next Step​