using System.Threading.Tasks;
using Workstation.ServiceModel.Ua;
public static async Task Main()
var getEndpointsRequest = new GetEndpointsRequest
EndpointUrl = "opc.tcp://opcua.rocks:4840",
ProfileUris = new[] { TransportProfileUris.UaTcpTransport }
Console.WriteLine($"Discovering endpoints of '{getEndpointsRequest.EndpointUrl}'.");
var getEndpointsResponse = await UaTcpDiscoveryService.GetEndpointsAsync(getEndpointsRequest);
Console.WriteLine($"Found {getEndpointsResponse.Endpoints.Length} endpoint(s).");
foreach(var ep in getEndpointsResponse.Endpoints.OrderBy(e => e.SecurityLevel))
Console.WriteLine($" EndpointUrl: '{ep.EndpointUrl}'.");
Console.WriteLine($" SecurityPolicy: '{ep.SecurityPolicyUri}'.");
Console.WriteLine($" SecurityMode: '{ep.SecurityMode}'.");
Console.WriteLine($" UserIdentityTokens: {String.Join(',', ep.UserIdentityTokens.Select(e=>e.TokenType.ToString()))}");
Console.WriteLine(ex.Message);