opc .net api list of servers
I'm writing opc client on c#. I want to get list of all opc servers on machine, how can i do it? I'm开发者_开发知识库 using opc .net API from opc foundation.
Per example to list all OPC DA 2.0 servers on a specific machine:
public void GetServers()
{
IDiscovery discovery = new OpcCom.ServerEnumerator();
//Get all local OPC DA servers of version 2.0
Opc.Server[] localservers = discovery.GetAvailableServers(Specification.COM_DA_20);
//Get all OPC DA servers of version 2.0 of machine "MyMachine"
Opc.Server[] hostservers = discovery.GetAvailableServers(Specification.COM_DA_20, "MyMachine", null);
}
精彩评论