コード例 #1
0
        private void button_read_short_Click(object sender, EventArgs e)
        {
            // 读取short变量
            if (textBox16.Text == "1")
            {
                DemoUtils.ReadResultRender(busTcpClient.ReadInt16(textBox3.Text), textBox3.Text, textBox4);
            }
            else
            {
                DemoUtils.ReadResultRender(busTcpClient.ReadInt16(textBox3.Text, ushort.Parse(textBox16.Text)), textBox3.Text, textBox4);
            }

            // 这一行是测试读取short数组的代码,忽略就行
            // short[] values = busTcpClient.ReadInt16( "100", 2 ).Content;
        }
コード例 #2
0
        private void thread_test2( )
        {
            int count = 500;

            while (count > 0)
            {
                if (!busTcpClient.Write("100", (short)1234).IsSuccess)
                {
                    failed++;
                }
                if (!busTcpClient.ReadInt16("100").IsSuccess)
                {
                    failed++;
                }
                count--;
            }
            thread_end( );
        }