View on GitHub

FreeOPCUA: An Open Source C++ OPC-UA Server and Client Library

Free OPC-UA is LGPL C++ library to develop server and client OPC-UA applications. Python bindings can be found in the opcua-python repository.

In addition an OPC-UA Python Client and Server library, written entirely in python, is available:

The C++ library is under development but works will all tested clients and servers. It support addressspace browse, read, write and address space modification as well as subscriptions and datachange events and method calls(the last one only on client).

History is not yet supported

All expected OPC-UA objects are implemented in C++. Higher level Server, Client and Node objects are also available.

Example high level Python server code:

server = opcua.Server()

    uri = ""
    idx = server.register_namespace(uri)

    objects = server.get_objects_node()

    myfolder = objects.add_folder(idx, "MyFolder")
    myvariable = myfolder.add_variable(idx, "MyVariable", 3)

    count = 0
    while True;
        count += 1


Or write lower level code in C++

Server = OpcUa::Remote::Connect(Endpoint);

OpcUa::Remote::SessionParameters session;
session.ClientDescription.URI = Uri;
session.ClientDescription.ProductURI = Uri;
session.ClientDescription.Name.Text = SessionName;
session.ClientDescription.Type = OpcUa::ApplicationType::CLIENT;
session.SessionName = SessionName;
session.EndpointURL = Endpoint;
session.Timeout = 1200000;


Getting Started

Next you can try compiling the code using the standard ./configure; make; make install commands

Example code

C++ sample code can be found here:

and then try to communicate with server using an opc-ua client (There are many free clients on the net)

I you want to use lower level api then have a look at: