Discovery

Unified Architecture topics related to OPC UA Specification, compliant behavior and any technical issues of OPC UA, like Security, Information Model, Companion Specs DI, PLCopen, ADI, ...

Moderator: Support Team

Post Reply
rakshan
Full Member
Full Member
Posts: 9
Joined: 07 Jun 2019, 08:35

Discovery

Post by rakshan »

Hello there,

I am trying to get familiar with the discovery functionality.
I have installed the LDS on my system. I have a sample server running (dummy server from another vendor)
If i keep the LDS service running, on the UAExpert client tool, if i put the discovery URL(opc:tcp://localhost:4840/UADiscovery) I am able to see the endpoints.

However, if I disable the LDS Service, and try putting in the URL for discovery(opc:tcp://localhost:4840/UADiscovery), it shows me an error.
(Bad communication error)

Is it not the case that the discovery end point constructed from the ghostname and portnumber, should provide the endpoint description irrespective of LDS active or not?

Please clarify.

Regards,
Rakshan

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: Discovery

Post by Support Team »

Hello,

the LDS (Local Discovery Server) runs on PC and provides a list of all other UA servers on this PC. In order to do so, all the local UA servers MUST register themselves at the LDS. Such registration at the LDS requires a secure connection to the LDS, hence the LDS and the UA Server must have a "trusted relation" (exchange certificates, and trust) in order to allow the registration.

Once registered properly at the LDS (the LDS runs on port 4840), the client's call to the LDS ("FindServers") will return the list of registered servers and their Endpoints.

Hint: make sure only the LDS uses the port 4840, all other UA servers on this particular PC must use different port. Our DemoServers (available from our Website) have LDS registration "disabled" by default, however can be switched on in configuration.
Best regards
Unified Automation Support Team

rakshan
Full Member
Full Member
Posts: 9
Joined: 07 Jun 2019, 08:35

Re: Discovery

Post by rakshan »

Hello,

Thanks for the answer, but if we do not have a discovery server installed or discovery service running, if suppose the client makes up the URL from out of band mechanism like -- ("opc.tcp://localhost:4840/UADiscovery), should it not show the servers which are registered already?

I had a server registered to the LDS and I was able to access the address space when the LDS was running.
But for situations without an LDS, the discovery URL should still show the endpoints right? It shows me a Bad communication error.

Please let me know.

Regards,
Rakshan

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: Discovery

Post by Support Team »

Hello,

if you don't have a LDS running, you will not get a list of UA Servers, you can only make an educated guess where (on which TCP port) the UA servers are running. If you have (accidently) running a "normal" UA Server on 4840, but not an LDS, than this one (1) OPC UA Server should be the only one running on this PC, in order to not interfere with LDS nor any other UA server claiming to run on port 4840.

On PC where you eventually have LDS running, the port 4840 is "reserved" for the LDS.
Only if you have only one single server running on the PC (there is no need for "list" of UA servers, because there exist only one server, hence no LDS required) you can let run this one server on 4840.

So the expectation is, on port 4840 you either have LDS exclusive OR you have (the only one) UA Server running on this PC. On embedded device or controller where you typically have only one (1) UA Server running (but no LDS) it is expected that this one UA Server runs on 4840. In any case "opc.tcp://<hostname/IPaddress>:4840" should give you an answer when calling FindServer/GetEndpoints
Best regards
Unified Automation Support Team

rakshan
Full Member
Full Member
Posts: 9
Joined: 07 Jun 2019, 08:35

Re: Discovery

Post by rakshan »

Hello there,

Thanks so much for the clarity.
I would just want to summarize it. So if we do not have an LDS running, we just make up the URL from hostname and establish the connection directly with the UA server, and only if LDS runs on the system, list of servers could be obtained.

However, I came across an article (https://www.automation.com/en-US/Articles/2015-2/how-opc-ua-clients-discover-servers-part-2], where the path was configured as "opc.tcp://lcoalhost:4840/UADiscovery" which says endpoint has to be obtained.


Anyway, another question I have is, We come across this funtionality, like getEndpoints(from client to server) and EndpointDescriptions(from server to client). On the UAExpert client application, when we type the URL of the discovery server, and press OK, it gives the server information registered.
Here, which part is the getEndpoints? When we press OK to see the list, and where would the EndpointDescription in return be?

Please let me know. Trying my best to get more clear picture

Regards,
Rakshan

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: Discovery

Post by Support Team »

Hello,

it probably brings more clarity when reading the OPC UA Specification instead of individual articles.

The short answer is: from a client side perspective the discovery procedure is always the same (it is transparent). The client opens a TCP connection on port 4840 to an IP/hostname (might be localhost) and calls "FindServers()". Now two things can happen: either you hit an LDS and the answer is a list of server URIs, OR you hit a single server (running on 4840 directly) and the answer is a list of servers with just one entry. That said for the client it does not matter. The client selects the Server-URI of choice. The client now does it's second call "GetEndpoints(URI)", this call always goes to the server URI the client has choosen to connect to, and the particular server will return a list of all endpoints he provides. This list can be rather large containing all endpoints and SecurityPolicies and combinations thereof (so called Endpoint-Descriptions). Now the client can look through all the endpoint descriptions and pick and choose the one he wants to finally "OpenSecureChannel" with.

The UaExpert is doing exactly the same: calling FindServers followed by GetEndpoints and adding the returned EndpointDescritions/SecurityPolicies into a Tree-GUI element (if you mouse-over you can see parts of the EndpointDescription information in the tooltip). Simple as that.
Best regards
Unified Automation Support Team

Post Reply