Skip to content

Latest commit

 

History

History
48 lines (34 loc) · 784 Bytes

GettingStarted.md

File metadata and controls

48 lines (34 loc) · 784 Bytes

Getting started

1. Create Solution

dotnet new sln

mkdir ClientApp
cd ClientApp
dotnet new console
dotnet add package Opc.UaFx.Client

cd ..
dotnet sln add ./ClientApp/ClientApp.csproj

mkdir ServerApp
cd ServerApp
dotnet new console
dotnet add package Opc.UaFx.Advanced

cd ..
dotnet sln add ./ServerApp/ServerApp.csproj

2. Implement Server

var node = new OpcDataVariableNode<string>("Hello", value: "Hello World!");

using (var server = new OpcServer(node)) {
    server.Start();

    Console.Write("Started.");
    Console.ReadLine();
}

3. Implement Client

using (var client = new OpcClient("opc.tcp://localhost:4840")) {
    client.Connect();

    Console.Write(client.ReadNode("ns=2;s=Hello"));
    Console.ReadLine();
}