Example programs
The quickest way to see the library work is to run its example programs: a master and an outstation in each language, which you drive interactively from the console.
Run an outstation and a master
Clone the repository, check out the tag for this version (1.8.0-RC1), and from its root start an
outstation with tcp-server and a master with tcp-client on the same machine. In Rust:
cargo run -p example-outstation -- tcp-server
cargo run -p example-master -- tcp-client
Then type help in either one to list the commands that change the outstation's values or send requests from the
master.
The C, C++, Java and .NET examples build with each language's usual tools (CMake, Maven, and the .NET SDK) against the published library for the tag's version, so you don't need to build the library from source.
Transports and arguments
Each language's master and outstation behave the same way and accept the same commands. Run them from the root of the
repository, so that they find the TLS certificates in ./certs. Both take the transport as their first argument:
| Example | Transports |
|---|---|
| Outstation | tcp-server, tcp-client, udp, serial, tls-ca, tls-self-signed |
| Master | tcp-client, udp, serial, tls-ca, tls-self-signed |
The C, C++, Java and .NET examples take one more optional argument: the endpoint to listen on or connect to, or the serial
port. Everything else, such as the DNP3 addresses, is a constant at the top of each program. The Rust examples take
options instead; run them with --help to list them, for example cargo run -p example-outstation -- --help.
The UDP transport only works on the local machine unless you change the endpoints in the program.
Source
The examples for each language, for this version:
The code snippets throughout this guide are pulled from these programs when the guide is built, so they always compile and stay up to date.