问题
DLL used : opcdaauto.dll from OPC Foundation
OPCServer ObjOPCServer;
OPCGroups ObjOPCGroups;
OPCGroup ObjOPCGroup;
ObjOPCServer = new OPCServer();
string _serverName = "Kepware.KEPServerEX.V5";
//In place of "", I need to give IP address of machine where OPC Server is present
ObjOPCServer.Connect(_serverName, "");
Then also I am not able to communicate . Any help highly appreciated.
Thanks in advance
回答1:
OPCServer ObjOPCServer = new OPCServer();
OPCGroups ObjOPCGroups;
OPCGroup ObjOPCGroup;
//string _serverName = "Kepware.KEPServerEX.V5";
string _serverName = "Matrikon.OPC.OMRON.1";
ObjOPCServer.Connect(_serverName, "192.168.0.110");
ObjOPCGroups = ObjOPCServer.OPCGroups;
ObjOPCGroup = ObjOPCGroups.Add("Group1");
ObjOPCGroup.DataChange += new DIOPCGroupEvent_DataChangeEventHandler(ObjOPCGroup_DataChange);
ObjOPCGroup.OPCItems.AddItem("#MonitorACLFile", 1);
//ObjOPCGroup.OPCItems.AddItem("Channel1.Device1.Tag2", 2);
ObjOPCGroup.UpdateRate = 1000;
ObjOPCGroup.IsActive = true;
ObjOPCGroup.IsSubscribed = true;
Refer : http://revanayya.blogspot.in/2013/12/opcclient-development-using-observer.html
来源:https://stackoverflow.com/questions/21874772/how-to-connect-remote-opc-server-using-opcdaauto-dll-using-c