程序功能: UDP服务器--转发串口数据
使用方法:1 打开串口 点击按钮就可
2 开启UDP服务端 点击按钮就可
3 根据显示的IP和端口,使用客户端连接到本服务器。
4 大功告成,串口与UDP客户端能够收发数据了
编译方法:
1 创建c#窗体应用程序,名字:Comx_UdpServer
2 在工程目录下新建 udpServer.cs 并添加到工程
3 复制udpServer.cs 的内容到 udpServer.cs
4 复制Form1.cs 的内容到 Form1.cs
5 复制Form1.Designer.cs 的内容到 Form1.Designer.cs
编译即可
环境:VS2008
编者:张永辉 2013年3月20日
文件:
Form1.cs
udpServer.cs
Program.cs
Form1.Designer.cs
待改进:1时间轮询是1MS
2现象1:串口发送1234567890 客户端第一次收到1, 下次收到234567890。
出现概率:1/14
3 收发数据不能太快。也够调试用
修改:弥补上上述问题
1 时间轮询是1MS
2 不再出现收不到整包的问题了。问题在串口接收函数
3 本服务器使用固定端口 60010
//****************************************************************************************
//Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using Udp_Server;
namespace Comx_UdpServer
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//载入窗体
private void Form1_Load(object sender, EventArgs e)
{
int a = 1;
//默认显示COMX 和 波特率
for (a = 1; a < 20;a++ )
{
comboBox_comx.Items.Add("COM" + a.ToString());
}
comboBox_baudrate.Items.Add("1200");
comboBox_baudrate.Items.Add("2400");
comboBox_baudrate.Items.Add("4800");
comboBox_baudrate.Items.Add("9600");
comboBox_baudrate.Items.Add("19200");
comboBox_baudrate.Items.Add("38400");
comboBox_baudrate.Items.Add("57600");
comboBox_baudrate.Items.Add("115200");
//默认显示的IP 和 port
listBox_hostip.Items.Clear();
listBox_hostip.Items.Add("0.0.0.0");
listBox_hostport.Items.Clear();
listBox_hostport.Items.Add("0");
label_clientIPport.Text = "点击显示当前客户端";
//主机IP和端口 由程序写,用户不能改变
listBox_hostip.Enabled = false;
listBox_hostport.Enabled = false;
//开启UDP服务
udps = new udpserver();
//创建服务线程,功能:在串口和UDP之间传递数据
UdpServerThread = new Thread(new ThreadStart(UdpServerMain));
UdpServerThread.Priority = ThreadPriority.Lowest;
UdpServerThread.Start();
Thread.Sleep(1); //主线程休眠1MS,会去执行oThread
while (!UdpServerThread.IsAlive) ; //等待oThread启动
}
//关闭窗体事件
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
//关闭串口
serialPort.Close();
//关闭UDP服务
udps.udpserverClose();
//关闭线程
UdpServerThread.Abort(); //终止oThread线程.其执行后果是Thread.Start()也不能启动oThread了。
UdpServerThread.Join(); //使主线程等待,直到oThread结束. 此处待改进,需要收到数据才会真正退出
}
//*************************************串口相关*******************************************
//【按钮】 打开/关闭串口
private void button_OpenCOM_Click(object sender, EventArgs e)
{
//获取当前波特率
string baud = comboBox_baudrate.Text;
serialPort.BaudRate = Convert.ToInt32(baud.Trim()); //若baud非纯数组,会抛异常
int bd = serialPort.BaudRate;
//-------------关闭串口---------------------------------------------
if (serialPort.IsOpen)
{
serialPort.Close();
button_OpenCOM.Text = "打开串口";
comboBox_baudrate.Enabled = true;
comboBox_comx.Enabled = true;
//MessageBox.Show("已经关闭:" + comboBox_comx.Text + ":" + bd.ToString());
radioButton_uart.Text = "已关闭";
radioButton_uart.Checked = false;
}
else
{
//------------打开串口----------------------------------------------
try
{
//获取串口名
serialPort.PortName = comboBox_comx.Text;
serialPort.Open();
button_OpenCOM.Text = "关闭串口";
comboBox_baudrate.Enabled = false;
comboBox_comx.Enabled = false;
//MessageBox.Show("打开成功:" + comboBox_comx.Text + ":" + bd.ToString());
radioButton_uart.Text = "已开启";
radioButton_uart.Checked = true;
}
catch (Exception ee)
{
//打开失败的情况
ee.GetType();
button_OpenCOM.Text = "打开串口";
comboBox_baudrate.Enabled = true;
comboBox_comx.Enabled = true;
MessageBox.Show("打开失败:" + comboBox_comx.Text + ":" + bd.ToString());
radioButton_uart.Text = "已关闭";
radioButton_uart.Checked = false;
}
}
if(isudpserver_on == true && serialPort.IsOpen)
{
label6.Text = "--连接成功--";
}else
{
label6.Text = "---未连接---";
}
}
public int usartRevData(byte[] revdata, int len)
{
int unm = 0;
if (serialPort.IsOpen == false)
{
return 0;
}
serialPort.ReadTimeout = 10; //接收超时1MS
try
{ //缓冲区有多少字节可以读取,有数据才去读取 原来的方法保留
/*unm = serialPort.BytesToRead;
len = (unm < len) ? (unm) : (len);
if (unm>0)
{ unm = serialPort.Read(revdata, 0, len); }*/
int cnt = 0;
unm = 0;
while (true)
{ //没有可以读取的则退出
cnt = serialPort.BytesToRead;
if (cnt<=0)
{
break;
}
//使用最小空间储存
cnt = (len > cnt) ? (cnt) : (len);
//revdata存数据 unm存个数
cnt = serialPort.Read(revdata, unm, cnt);
unm += cnt;
//计算剩余空间长度
len = len - cnt;
if (len<=0)
{
break;
}
//等待未接收完的数据就绪
int t = 4 * 10 * 1000 / BaudRate; //接收4个数据的时间
Thread.Sleep(t + 1); //多给1毫秒
}
//实验:之前没有使用serialPort.BytesToRead函数,利用当没有数据可读时serialPort.Read()抛出异常
//作为没有数据的依据。 会出现一个现象:有1/10的机会收不到一个完整的数据,下次接收上次未接收的数据。
}
catch (Exception e)
{
//没有读到数据
//MessageBox.Show(e.Message);
e.GetType();
unm = 0;
}
return unm;
}
//*************************************UDP 相关*******************************************
//【按钮】 显示当前连接到服务器的 客户端
private void label_clientIPport_Click(object sender, EventArgs e)
{
if (udps.ClientIp == "0.0.0.0:0")
{
label_clientIPport.Text = "当前客户端:无客户端连接到此";
}
else
{
label_clientIPport.Text = "当前客户端:" + udps.ClientIp;
}
}
//【按钮】 开启/关闭Udp服务
private void button_UdpservOpen_Click(object sender, EventArgs e)
{
if (isudpserver_on == true)
{
//关闭UDP服务
button_UdpservOpen.Text = "启动UDP服务";
isudpserver_on = false;
radioButton_udp.Text = "已关闭";
radioButton_udp.Checked = false;
}
else
{
//开启UDP服务
button_UdpservOpen.Text = "关闭UDP服务";
listBox_hostip.Items.Clear();
listBox_hostip.Items.Add(udps.HostIp);
listBox_hostport.Items.Clear();
listBox_hostport.Items.Add(udps.HostpPort);
isudpserver_on = true;
radioButton_udp.Text = "已开启";
radioButton_udp.Checked = true;
}
if (isudpserver_on == true && serialPort.IsOpen)
{
label6.Text = "--连接成功--";
}
else
{
label6.Text = "---未连接---";
}
}
//udp服务线程 进行双向数据传递
udpserver udps; //udp服务
bool isudpserver_on = false; //服务状态
Thread UdpServerThread; //服务的线程
byte[] UdpToUart = new byte[2048]; //缓冲器
byte[] UartToUdp = new byte[2048]; //缓冲器
void UdpServerMain()
{
int unm;
while (true)
{
Thread.Sleep(1);
//两个端口都开启才进行数据传递
if (isudpserver_on == false || serialPort.IsOpen == false)
{
Thread.Sleep(100);
//虽然界面没有打开,事实上已经打开了的
usartRevData(UartToUdp, 2048);
udps.udpserverRecv(UdpToUart, 2048);
continue;
}
//数据流向:UDP数据-->-->--UART端口
unm = udps.udpserverRecv(UdpToUart,2048);
if (unm > 0)
{
serialPort.Write(UdpToUart, 0, unm);
}
//数据流向:UART数据-->-->--UDP端口
unm = usartRevData(UartToUdp, 2048);
if (unm>0)
{
//没有客户连接到服务器时不能发送数据到客户
if (udps.ClientIp != "0.0.0.0:0")
{
udps.udpserverSend(UartToUdp, unm);
}
}
}
}
}
}
//****************************************************************************************
//udpServer.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading; //使用Thread类来创建和控制线程
using System.Net;
using System.Net.Sockets;
namespace Udp_Server
{
//udp服务端
class udpserver
{
//------------------------服务端相关定义-------------------------
string hostName; //主机名
string hostipaddr; //主机IP
int hostport; //将使用的端口
IPEndPoint ipep;
Socket newsock;
public string HostName //主机属性
{ get{ return hostName;}
}
public string HostIp
{ get{ return hostipaddr; }
}
public int HostpPort
{
get { return hostport; }
}
//------------------客户端相关定义----------------------------------
IPEndPoint sender; //客户端IP
EndPoint Remote; //客户端端口
public string ClientIp //客户属性。 有客服连接时才有
{
get{ return Remote.ToString();}
}
public string ClientPort
{
get { return Remote.ToString(); }
}
//构造函数
public udpserver()
{
hostName = Dns.GetHostName(); //本机名
System.Net.IPAddress[] addressList = Dns.GetHostAddresses(hostName);//会返回所有地址,包括IPv4和IPv6
hostipaddr = addressList[1].ToString(); //得到本机IP
hostport = 60010; //使用固定端口
ipep = new IPEndPoint(addressList[1], hostport); //设置UCP端口号
newsock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
newsock.Bind(ipep); //绑定网络地址
//得到客户机IP和端口 此处是所有IP,所以立即得到0.0.0.0
sender = new IPEndPoint(IPAddress.Any, 0);
Remote = (EndPoint)(sender);
}
//关闭串口
public void udpserverClose()
{
newsock.Close();
}
//接收数据
//返回:int :收到的数据个数 Recvdata:收到的数据
public int udpserverRecv(byte[] Recvdata, int maxnum)
{
int recvnum = 0;
//int recvnumall = 0;
//收到的数据个数
if (newsock.Poll(50, SelectMode.SelectRead))
{
recvnum = newsock.ReceiveFrom(Recvdata, maxnum, 0, ref Remote); //真正的等待在此
}
if (recvnum < 0)
{
recvnum = 0;
}
return recvnum;
}
//发送数据
//参数:Senddata:数组数据 SendNum:数据个数
public void udpserverSend(byte[] Senddata,int SendNum)
{
newsock.SendTo(Senddata, SendNum, SocketFlags.None, Remote);
}
}
}
//****************************************************************************************
//Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace Comx_UdpServer
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
//****************************************************************************************
//Form1.Designer.cs
namespace Comx_UdpServer
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.label1 = new System.Windows.Forms.Label();
this.comboBox_comx = new System.Windows.Forms.ComboBox();
this.label_baudrate = new System.Windows.Forms.Label();
this.comboBox_baudrate = new System.Windows.Forms.ComboBox();
this.serialPort = new System.IO.Ports.SerialPort(this.components);
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.button_OpenCOM = new System.Windows.Forms.Button();
this.button_UdpservOpen = new System.Windows.Forms.Button();
this.label_Hostip = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.listBox_hostip = new System.Windows.Forms.ListBox();
this.listBox_hostport = new System.Windows.Forms.ListBox();
this.label_clientIPport = new System.Windows.Forms.Label();
this.groupBox_comx = new System.Windows.Forms.GroupBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label6 = new System.Windows.Forms.Label();
this.radioButton_udp = new System.Windows.Forms.RadioButton();
this.radioButton_uart = new System.Windows.Forms.RadioButton();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.groupBox_comx.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
// label1
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(23, 28);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(29, 12);
this.label1.TabIndex = 0;
this.label1.Text = "串口";
// comboBox_comx
this.comboBox_comx.FormattingEnabled = true;
this.comboBox_comx.Location = new System.Drawing.Point(77, 25);
this.comboBox_comx.Name = "comboBox_comx";
this.comboBox_comx.Size = new System.Drawing.Size(69, 20);
this.comboBox_comx.TabIndex = 2;
this.comboBox_comx.Text = "COM1";
// label_baudrate
this.label_baudrate.AutoSize = true;
this.label_baudrate.Location = new System.Drawing.Point(23, 69);
this.label_baudrate.Name = "label_baudrate";
this.label_baudrate.Size = new System.Drawing.Size(41, 12);
this.label_baudrate.TabIndex = 3;
this.label_baudrate.Text = "波特率";
// comboBox_baudrate
this.comboBox_baudrate.FormattingEnabled = true;
this.comboBox_baudrate.Location = new System.Drawing.Point(77, 61);
this.comboBox_baudrate.Name = "comboBox_baudrate";
this.comboBox_baudrate.Size = new System.Drawing.Size(69, 20);
this.comboBox_baudrate.TabIndex = 4;
this.comboBox_baudrate.Text = "9600";
// label2
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(75, 98);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(53, 12);
this.label2.TabIndex = 5;
this.label2.Text = "8bit数据";
// label3
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(75, 124);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(71, 12);
this.label3.TabIndex = 6;
this.label3.Text = "1bit 停止位";
// label4
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(75, 149);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(41, 12);
this.label4.TabIndex = 7;
this.label4.Text = "无校验";
// button_OpenCOM
this.button_OpenCOM.BackColor = System.Drawing.SystemColors.Control;
this.button_OpenCOM.Location = new System.Drawing.Point(25, 205);
this.button_OpenCOM.Name = "button_OpenCOM";
this.button_OpenCOM.Size = new System.Drawing.Size(121, 23);
this.button_OpenCOM.TabIndex = 8;
this.button_OpenCOM.Text = "打开";
this.button_OpenCOM.UseVisualStyleBackColor = false;
this.button_OpenCOM.Click += new System.EventHandler(this.button_OpenCOM_Click);
// button_UdpservOpen
this.button_UdpservOpen.Location = new System.Drawing.Point(23, 200);
this.button_UdpservOpen.Name = "button_UdpservOpen";
this.button_UdpservOpen.Size = new System.Drawing.Size(184, 23);
this.button_UdpservOpen.TabIndex = 9;
this.button_UdpservOpen.Text = "开启服务";
this.button_UdpservOpen.UseVisualStyleBackColor = true;
this.button_UdpservOpen.Click += new System.EventHandler(this.button_UdpservOpen_Click);
// label_Hostip
this.label_Hostip.AutoSize = true;
this.label_Hostip.Location = new System.Drawing.Point(19, 28);
this.label_Hostip.Name = "label_Hostip";
this.label_Hostip.Size = new System.Drawing.Size(53, 12);
this.label_Hostip.TabIndex = 10;
this.label_Hostip.Text = "服务器IP";
// label5
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(21, 69);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(65, 12);
this.label5.TabIndex = 11;
this.label5.Text = "服务器Port";
// listBox_hostip
this.listBox_hostip.FormattingEnabled = true;
this.listBox_hostip.ItemHeight = 12;
this.listBox_hostip.Location = new System.Drawing.Point(93, 28);
this.listBox_hostip.Name = "listBox_hostip";
this.listBox_hostip.Size = new System.Drawing.Size(103, 16);
this.listBox_hostip.TabIndex = 12;
// listBox_hostport
this.listBox_hostport.FormattingEnabled = true;
this.listBox_hostport.ItemHeight = 12;
this.listBox_hostport.Location = new System.Drawing.Point(93, 69);
this.listBox_hostport.Name = "listBox_hostport";
this.listBox_hostport.Size = new System.Drawing.Size(103, 16);
this.listBox_hostport.TabIndex = 13;
// label_clientIPport
this.label_clientIPport.AutoSize = true;
this.label_clientIPport.Location = new System.Drawing.Point(21, 112);
this.label_clientIPport.Name = "label_clientIPport";
this.label_clientIPport.Size = new System.Drawing.Size(65, 12);
this.label_clientIPport.TabIndex = 14;
this.label_clientIPport.Text = "无客服连接";
this.label_clientIPport.Click += new System.EventHandler(this.label_clientIPport_Click);
// groupBox_comx
this.groupBox_comx.Controls.Add(this.radioButton_uart);
this.groupBox_comx.Controls.Add(this.label3);
this.groupBox_comx.Controls.Add(this.label1);
this.groupBox_comx.Controls.Add(this.comboBox_comx);
this.groupBox_comx.Controls.Add(this.label_baudrate);
this.groupBox_comx.Controls.Add(this.comboBox_baudrate);
this.groupBox_comx.Controls.Add(this.label2);
this.groupBox_comx.Controls.Add(this.label4);
this.groupBox_comx.Controls.Add(this.button_OpenCOM);
this.groupBox_comx.ForeColor = System.Drawing.SystemColors.MenuText;
this.groupBox_comx.Location = new System.Drawing.Point(22, 22);
this.groupBox_comx.Name = "groupBox_comx";
this.groupBox_comx.Size = new System.Drawing.Size(196, 259);
this.groupBox_comx.TabIndex = 15;
this.groupBox_comx.TabStop = false;
this.groupBox_comx.Text = "串口连接";
// groupBox1
this.groupBox1.Controls.Add(this.radioButton_udp);
this.groupBox1.Controls.Add(this.button_UdpservOpen);
this.groupBox1.Controls.Add(this.label_Hostip);
this.groupBox1.Controls.Add(this.label_clientIPport);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.listBox_hostport);
this.groupBox1.Controls.Add(this.listBox_hostip);
this.groupBox1.ForeColor = System.Drawing.SystemColors.MenuText;
this.groupBox1.Location = new System.Drawing.Point(301, 27);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(242, 254);
this.groupBox1.TabIndex = 16;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Udp服务器";
// label6
this.label6.AutoSize = true;
this.label6.ForeColor = System.Drawing.SystemColors.MenuText;
this.label6.Location = new System.Drawing.Point(224, 139);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(77, 12);
this.label6.TabIndex = 17;
this.label6.Text = "---未连接---";
// radioButton_udp
this.radioButton_udp.AutoSize = true;
this.radioButton_udp.BackColor = System.Drawing.SystemColors.ButtonFace;
this.radioButton_udp.Location = new System.Drawing.Point(23, 163);
this.radioButton_udp.Name = "radioButton_udp";
this.radioButton_udp.Size = new System.Drawing.Size(59, 16);
this.radioButton_udp.TabIndex = 15;
this.radioButton_udp.Text = "已关闭";
this.radioButton_udp.UseVisualStyleBackColor = false;
// radioButton_uart
this.radioButton_uart.AutoSize = true;
this.radioButton_uart.Location = new System.Drawing.Point(25, 168);
this.radioButton_uart.Name = "radioButton_uart";
this.radioButton_uart.Size = new System.Drawing.Size(59, 16);
this.radioButton_uart.TabIndex = 9;
this.radioButton_uart.TabStop = true;
this.radioButton_uart.Text = "已关闭";
this.radioButton_uart.UseVisualStyleBackColor = true;
// label7
this.label7.AutoSize = true;
this.label7.ForeColor = System.Drawing.Color.Green;
this.label7.Location = new System.Drawing.Point(22, 296);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(171, 19);
this.label7.TabIndex = 18;
this.label7.Text = "功 能 :数据双向透明传输";
this.label7.UseCompatibleTextRendering = true;
// label8
this.label8.AutoSize = true;
this.label8.ForeColor = System.Drawing.Color.Green;
this.label8.Location = new System.Drawing.Point(22, 319);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(293, 12);
this.label8.TabIndex = 19;
this.label8.Text = "传输过程1:CMx收到数据A,Udp再将A发送到他的客户端";
// label9
this.label9.AutoSize = true;
this.label9.ForeColor = System.Drawing.Color.Green;
this.label9.Location = new System.Drawing.Point(22, 344);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(347, 12);
this.label9.TabIndex = 20;
this.label9.Text = "传输过程2:Udp服务器收到来自客户端的数据B,CMx将B发送出去";
// label10
this.label10.AutoSize = true;
this.label10.ForeColor = System.Drawing.Color.MediumSeaGreen;
this.label10.Location = new System.Drawing.Point(466, 344);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(77, 12);
this.label10.TabIndex = 21;
this.label10.Text = "zhangyonghui";
// label11
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(460, 332);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(83, 12);
this.label11.TabIndex = 22;
this.label11.Text = "Free Ver1.0.0";
// Form1
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(567, 371);
this.Controls.Add(this.label11);
this.Controls.Add(this.label10);
this.Controls.Add(this.label9);
this.Controls.Add(this.label8);
this.Controls.Add(this.label7);
this.Controls.Add(this.label6);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.groupBox_comx);
this.ForeColor = System.Drawing.Color.DarkBlue;
this.Name = "Form1";
this.Text = "串口-UDP服务器数据转发器";
this.Load += new System.EventHandler(this.Form1_Load);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed);
this.groupBox_comx.ResumeLayout(false);
this.groupBox_comx.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox comboBox_comx;
private System.Windows.Forms.Label label_baudrate;
private System.Windows.Forms.ComboBox comboBox_baudrate;
private System.IO.Ports.SerialPort serialPort;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button button_OpenCOM;
private System.Windows.Forms.Button button_UdpservOpen;
private System.Windows.Forms.Label label_Hostip;
private System.Windows.Forms.Label label5;
public System.Windows.Forms.ListBox listBox_hostip;
private System.Windows.Forms.ListBox listBox_hostport;
private System.Windows.Forms.Label label_clientIPport;
private System.Windows.Forms.GroupBox groupBox_comx;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.RadioButton radioButton_udp;
private System.Windows.Forms.RadioButton radioButton_uart;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label11;
}
}