コード例 #1
0
        public static void ReadWriteMoreThanOnePduParallelTest()
        {
            //_client.OnLogEntry += Console.WriteLine;
            //_client.Connect(ConnectionString);
            //Assert.AreEqual(true, _client.IsConnected);

            const int length = 24000;

            var testData = new byte[length];

            for (var i = 0; i < testData.Length; i++)
            {
                testData[i] = 0x01;
            }

            var sw = new Stopwatch();

            sw.Start();
            _client.WriteAnyParallel(PlcArea.DB, 0, testData, new[] { length, LongDbNumer });
            sw.Stop();
            Console.WriteLine("Write time: {0}ms", sw.ElapsedMilliseconds);

            sw.Reset();
            sw.Start();
            var red = _client.ReadAnyParallel(PlcArea.DB, 0, typeof(byte), new[] { length, LongDbNumer }) as byte[];

            sw.Stop();
            Console.WriteLine("Read time: {0}ms", sw.ElapsedMilliseconds);

            //Assert.IsNotNull(red);
            //Assert.IsTrue(testData.SequenceEqual(red));
            //client.Disconnect();
        }