dnp3 / opendnp3

DNP3 (IEEE-1815) protocol stack. Modern C++ with bindings for .NET and Java.
https://dnp3.github.io
Apache License 2.0
300 stars 231 forks source link

Using Master example to query remote host #399

Closed poratamit closed 4 years ago

poratamit commented 4 years ago

Hi, I am working on Ubuntu 18.04. I tried to use the Master example in the cpp directory in order to query a remote host/rtu.

So I replaced 127.0.0.1 in this line: auto channel = manager.AddTCPClient("tcpclient", logLevels, ChannelRetry::Default(), {IPEndpoint("127.0.0.1", 20000)}, "0.0.0.0", PrintingChannelListener::Create()); to the the dest ip. Also, I modified this bool from true to false: stackConfig.master.disableUnsolOnStartup = false;

Now, when I run the app, it performs Read, class 0123 every 7 seconds. When I try to insert one of the commands, like 'a', it does enter the case in the switch, but it doesn't send the packet at all.

How can I disable this periodic scan, and just perform scans on demand?

Thanks

jadamcrain commented 4 years ago

By default, no periodic scans are enabled. My guess is that the master is getting something back in response to the class 1230 scan that it doesn't understand and is stuck retrying.

Can you enable protocol logging and send us a trace?

poratamit commented 4 years ago

Here are the code and the trace. Note that I didn't enter any command after the menu, it queries the remote host class 0 1 2 3 without me doing it.

trace.txt

main.txt

emgre commented 4 years ago

Your outstation is responding with a delay of around 8 to 9 seconds. The master is configured with a timeout of 2 seconds. Therefore, the startup integrity poll (the class 1230) is retried even if you are not asking for anything. Also, any command won't send anything because the startup sequence isn't completed.

You should probably fix the outstation or the network. Such a delay is generally not normal. If you can't do anything about the outstation or the network, try increasing the stackConfig.master.responseTimeout to something higher than 9 seconds.