public void Run()
        {
            random = new Random(testConfig.seed);
            IDNP3Manager mgr = DNP3ManagerFactory.CreateManager(1);

            channel = mgr.AddTCPClient("client", LogLevels.NONE, ChannelRetry.Default, testConfig.host, testConfig.port);
            channel.AddStateListener(state => { });

            ConfigureOutstation();
            Console.WriteLine("[{0}] Starting Value change...", testConfig.seed);

            while (true)
            {
                for (int i = 0; i < testConfig.actionsPerCycle; ++i)
                {
                    ExecuteSignal();
                }
                Thread.Sleep(testConfig.testTime);
                var eventRecorder = testConfig.eventRecorder;
                Console.WriteLine("");
                Console.WriteLine(
                    "  --- Batch executed: PendingS:" + eventRecorder.GetPending() +
                    " ErrorsS:" + eventRecorder.Errors +
                    " OfS:" + eventRecorder.Total);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Attempts to connect to data input source.
        /// </summary>
        /// <remarks>
        /// Derived classes should attempt connection to data input source here.  Any exceptions thrown
        /// by this implementation will result in restart of the connection cycle.
        /// </remarks>
        protected override void AttemptConnection()
        {
            TcpClientConfig tcpConfig = m_masterConfig.client;
            string          portName  = tcpConfig.address + ":" + tcpConfig.port;
            TimeSpan        minRetry  = TimeSpan.FromMilliseconds(tcpConfig.minRetryMs);
            TimeSpan        maxRetry  = TimeSpan.FromMilliseconds(tcpConfig.maxRetryMs);

            IChannel channel = s_manager.AddTCPClient(portName, tcpConfig.level, minRetry, maxRetry, tcpConfig.address, tcpConfig.port);

            channel.AddStateListener(state => OnStatusMessage(portName + " - Channel state change: " + state));
            m_channel = channel;

            IMaster master = channel.AddMaster(portName, m_soeHandler, m_masterConfig.master);

            master.Enable();
            m_active = true;
        }