Code sample for an OpenDNP3 library problem: master always polling the outstation

410 Views Asked by At

I run the code sample that is included on GitHub for GitHub OpenDNP3 with the most recent NuGet package of this library and the sample seems to do not work as expected.

I start the outstation. Then I start the master. The result of the master is constantly polling the outstation. It never stops. I thought it could do one integrity poll (or not) and wait for me to press a key, but I can't. The screen is always dumping the state of the outstation.

Is OpenDNP3 working properly and/or is the sample bugged?

Output of master

1

There are 1 best solutions below

0
Eric Ouellet On

I just found my solution. The sample can't be run as is; it should be included into a console application. The problem arise when you take the code and include it into a Windows application (any, like a WPF application). When you do so, Console.ReadLine will not stop waiting for the user to press "Enter" like in a console app because the standard input device for a Windows application is not the keyboard. See documentation: Console.ReadLine Method

'If the standard input device is the keyboard, the ReadLine method blocks until the user presses the Enter key.'

But it does not stop and wait in a Windows application.