Пример #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            // 数据发送
            NetHandle handle = new NetHandle( );

            if (textBox5.Text.IndexOf('.') >= 0)
            {
                string[] values = textBox5.Text.Split('.');
                handle = new NetHandle(byte.Parse(values[0]), byte.Parse(values[1]), ushort.Parse(values[2]));
            }
            else
            {
                handle = int.Parse(textBox5.Text);
            }


            int      count = int.Parse(textBox6.Text);
            DateTime start = DateTime.Now;

            for (int i = 0; i < count; i++)
            {
                OperateResult <string> read = udpClient.ReadFromServer(handle, textBox4.Text);
                if (read.IsSuccess)
                {
                    textBox8.AppendText(read.Content + Environment.NewLine);
                }
                else
                {
                    textBox8.AppendText("Read Failed:" + read.Message + Environment.NewLine);
                }
            }
        }
Пример #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            // 数据发送

            DateTime start = DateTime.Now;

            OperateResult <string> read = udpClient.ReadFromServer(textBox4.Text);

            if (read.IsSuccess)
            {
                textBox8.AppendText(read.Content + Environment.NewLine);
            }
            else
            {
                textBox8.AppendText("Read Failed:" + read.Message + Environment.NewLine);
            }
        }