titanium-as / TitaniumAS.Opc.Client

Open source .NET client library for OPC DA
MIT License
197 stars 93 forks source link

Getting a list of available OPC servers #18

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hey there,

great library! I've just been messing around with it today and it's working mostly great but I have one question.

Is there a way to get all available Opc servers on the machine? I know other Opc DA client libraries can do this and it's important if you don't know the name of the server.

Thanks and keep up the good work!

ghost commented 7 years ago

This is related to #9

If you can point me to some information about how OpcServer browsing works I could try implementing it. But I'm new to OPC Clients so I'm a bit lost.

It seems you should be able to get a list from the OpcEnum.exe service running, but I cannot find any specification anywhere on how to communicate with it. Any documentation from OPC Foundation is locked behind a "Corporate member only" wall. Alternatively you could read the registered OPC Servers from the Registry, but this is generally considered unsafe (which is why OpcEnum was introduced.).

Any experience with communicating with OpcEnum? I will keep looking.

alexey-titov commented 7 years ago

Hello! Thanks for review.

You can enumerate hosts and servers with OpcServerEnumeratorAuto.

See tests for details. TitaniumAS.Opc.Client/TitaniumAS.Opc.Client.Tests/Common/OpcServerEnumeratorAutoTests.cs