An open source OPC DA Client SDK/ToolKit written in C++, support both 32 bit and 64 bit.
Current master branch contains a huge bug fixes commit from PR#14, which might introduce some new bugs. If the master branch went wrong, you may check release 0.4.1 as a backup.
OPC Core Component x64
is NECESSARY if you want to build x64 project, I bundled the 3.0.105.1
version (seems more popular).hostname
, then input server ID
, it should
work.hostname
instead of IP address
for reasons below.
services.msc
COPCCLint::init
and COPCClinet::stop
in every thread. There are two method to init, in one application,
different thread could use different method.
COPCClient::init(MULTITHREADED)
to init thread OLE, then the COPCxxx
created in the thread
could be accessed from other thread that is also inited with MULTITHREADED
.COPCClient::init()
to init thread OLE, but all COPCxxx
created in the thread can't be
accessed from different thread.COPCClient::init()
in main thread (the
UI thread)
. (See MSDN)
.Date: 2021-10-10
Date: 2017-07-07
Date: 2017-04-13
// connect local server
LocalSyncOPCCLient* client = new LocalSyncOPCCLient;
client->Init();
if (client->Connect("Matrikon.OPC.Simulation.1"))
{
// sync write and sync read
client->WriteUint16("Bucket Brigade.UInt2", 998);
std::cout << client->ReadUint16("Bucket Brigade.UInt2");
// disconnect and stop
client->DisConnect();
client->Stop();
delete client;
}
IsOPCConnectedPLC()
to make connection more safetyItemNameFilter(std::string)
to avoid adding useless itemsDate:2016-12-13
COPCClient::init()
and COPCClient::stop()
in every thread.Date:2016-07-01
Date:2016-05-31
OPC Core Component 3.0.106
.