Skip to content
Start free evaluation

pdcomm_opcua_discover

Function

Reads the endpoints of a server (GetEndpoints).

int32_t pdcomm_opcua_discover(const uint8_t *endpoint, size_t size, uint32_t timeout_ms, pdcomm_opcua_handle *out)

Declared in: #include <pdcomm/opcua/pdcomm_opcua.h>

Opens a SecurityPolicy None secure channel to endpoint, sends GetEndpoints with that endpoint URL and closes the channel. Discovery is unauthenticated: no certificate is validated here, so verify a returned server certificate before you trust it.

The result is an owned buffer with a UA Binary GetEndpointsResponse (encoding ID 431), including its namespace zero encoding NodeId prefix (Part 6, 5.2.9). It holds the server's EndpointDescriptions with an empty ResponseHeader.

Parameters

NameDescription
endpointopc.tcp://host[:port][/path] URL in UTF-8, 1 to 4096 bytes. The default port is 4840.
sizeSize of endpoint in bytes.
timeout_msTimeout of each network exchange, 1 to 300000 ms.
outReceives the response buffer handle.

Returns

#PDCOMM_OPCUA_OK, #PDCOMM_OPCUA_INVALID_INPUT, #PDCOMM_OPCUA_RUNTIME_ERROR for a URL that is not opc.tcp://, a network failure or a protocol failure, #PDCOMM_OPCUA_LIMIT, or #PDCOMM_OPCUA_LICENSE_REQUIRED without an opcua-client license.

Notes

  • Blocks the calling thread for up to the timeout per exchange.