private void button1_Click(object sender, EventArgs e)
        {
            toolStripStatusLabel1.Text = "服务器已经启动,开始接收数据";
            Thread Run1 = new Thread(new ThreadStart(Run));
            Run1.Start();
        }
        public void Run()
        {            
            UdpClient RecServ = new UdpClient(10000);
            IPEndPoint myip = new IPEndPoint(IPAddress.Any,0);
            string str = null;
            byte[] msg = null;
            char[] split = { '|' };
            while (true)
            {
                msg = RecServ.Receive(ref myip);
                str = System.Text.Encoding.BigEndianUnicode.GetString(msg);
                string[] Recstr = str.Split(split);
                toolStripStatusLabel1.Text = Recstr[0] + "  "+"客户已经连接" + Recstr[1];
            }
        }
我自己写的代码。希望对你有用!!